proxy-like python module -
In case of self-import, may the python module be hand in other modules?
You can do this (in normal CPYthon too):
# Uglyhack.py Import System Import Other Modules sys.modules [__name__] = Other module
then:
& gt; & Gt; & Gt; Import uglyhack & gt; & Gt; & Gt; Uglyhack & lt; Module 'Other Modules' to '...' & gt;
This depends on the global assignment for imported script module / module is being imported after the imported module is removed, so when the import assignment occurs, then sys .modules
lookup has been broken up to point to another module.
I will not use it (possibly) in the appropriate code for anything other than debugging.
Comments
Post a Comment