2007-01-24 22:24:01 +08:00
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
class Std(object):
|
2007-02-04 22:27:10 +08:00
|
|
|
""" (lazily) hook into the top-level standard library """
|
|
|
|
|
2007-01-24 22:24:01 +08:00
|
|
|
def __init__(self):
|
|
|
|
self.__dict__ = sys.modules
|
|
|
|
|
|
|
|
def __getattr__(self, name):
|
|
|
|
try:
|
|
|
|
m = __import__(name)
|
|
|
|
except ImportError:
|
|
|
|
raise AttributeError("py.std: could not import %s" % name)
|
|
|
|
return m
|
|
|
|
|
|
|
|
std = Std()
|