Getting the module name from a method...

Olivier Deckmyn olivier.deckmyn at mail.dotcom.fr
Tue Aug 17 09:32:41 EDT 1999


Hi !

I would like a method of my own to be able to print the module it is
declared in:

ex:
the text for the module : toto.py is :

class MyClass:
    def myMethod(self):
        print "I am in module", ????????

and then
MyClass().myMethod()
should produce :
'toto'

....
Thanx for your help !

---
Olivier Deckmyn, Paris - France
"Any sufficiently advanced technology is indistinguishable from
magic." -Arthur C. Clark






More information about the Python-list mailing list