
hitt at eskimo
Sep 12, 2001, 11:31 AM
Views: 270
Permalink
|
|
referencing the module a piece of code is in
|
|
I'd like to be able to get a reference to a module a piece of code is in. I can do something like: # my_module.py class dummy: pass def my_module(): import sys return sys.modules[dummy.__module__] but this feels much too lengthy. I'd prefer something like # my_desired_module.py def my_module(): return __nifty_abbreviation_for_module__ Is this possible (and if not, why not?)? Thanks in advance for any info (including references to the FAQ etc). dan
|