Getting the module name from a method...
Stephen J. Turner
sjturner at ix.netcom.com
Tue Aug 17 19:15:41 CEST 1999
Olivier Deckmyn wrote:
> I would like a method of my own to be able to print the module it is
> declared in:
> the text for the module : toto.py is :
> class MyClass:
> def myMethod(self):
> print "I am in module", ????????
> and then
> should produce :
How about "self.__class__.__module__"?
Stephen J. Turner <sjturner at ix.netcom.com>
More information about the Python-list