How to pass a reference to the current module
James Stroud
jstroud at mbi.ucla.edu
Sat Aug 4 02:35:21 EDT 2007
Paul Rubin wrote:
> Hmm, it's a pain that there's no clean way to get at the current
> module. PEP 3130 shows some icky and unreliable ways, e.g.
>
> func = getattr(sys.modules[__name__], 'f')
>
> PEP 3130's goal was to add a clean way to do this. Unfortunately it
> was rejected.
Yes, this is the essence of the problem. At least I'm not the only one
to have needed (or at least wanted) this.
James
More information about the Python-list
mailing list