annotate orpg/external/std.py @ 72:8bc955faf819
ornery-dev
Fixing a few mistakes from the last update. When Controls is finished I will be happy because users won't miss an file change due to these small updates.
author |
sirebral |
date |
Thu, 20 Aug 2009 03:45:45 -0500 |
parents |
c54768cffbd4 |
children |
|
rev |
line source |
66
|
1
|
|
2 import sys
|
|
3
|
|
4 class Std(object):
|
|
5 """
|
|
6 makes all standard python modules available as a lazily
|
|
7 computed attribute.
|
|
8 """
|
|
9
|
|
10 def __init__(self):
|
|
11 self.__dict__ = sys.modules
|
|
12
|
|
13 def __getattr__(self, name):
|
|
14 try:
|
|
15 m = __import__(name)
|
|
16 except ImportError:
|
|
17 raise AttributeError("py.std: could not import %s" % name)
|
|
18 return m
|
|
19
|
|
20 std = Std()
|