Using the __builtins__ module to assign new global variables
Opinder
osbhella at yahoo.com
Mon Mar 1 16:48:06 EST 2004
Hi,
For the Python experts out there:
Are there any side effects in assigning new variables to the
__builtins__ module for the purpose of exposing variables to imported
modules.
For example.
#/ main file
class Test: pass
mytest = Test() #/ instance of a class
__builtins__.mytest = mytest
import abc
#/ -----------------------
#/ This is the abc.py module file
#/ This should work because of the __builtins__ above
print mytest
Thanks.
More information about the Python-list
mailing list