Re: How to use __getattr__ to the current module, for automatically add attributes of the real-time

2012-09-18 Thread Jean-Michel Pichavant
- Original Message - > Want to work so: > > import sys > class Foo(object): > def __getattr__(self, t): >print 'use __getattr__ - ', t >return type(t, (object,), {}) > def funct1(self): pass > def funct2(self): pass > > sys.modules[__name__] = Foo() > ttt('yy')

How to use __getattr__ to the current module, for automatically add attributes of the real-time

2012-09-18 Thread sergeiiv65
Want to work so: import sys class Foo(object): def __getattr__(self, t): print 'use __getattr__ - ', t return type(t, (object,), {}) def funct1(self): pass def funct2(self): pass sys.modules[__name__] = Foo() ttt('yy') name 'ttt' is not defined. __getattr__ not work ((