Embedding: Getting the module from a PyObject *
Adrian Eyre
a.eyre at optichrome.com
Wed Nov 24 04:33:38 EST 1999
> can anyone tell me how to get the module object that a certain instance's
> class is defined in, from that instance?
Assuming:
class Spam:
pass
s = Spam()
Then:
s.__class__ returns class Spam
Spam.__module__ or s.__class__.__module__ returns the module it was defined
in
--------------------------------------------
Adrian Eyre <mailto:a.eyre at optichrome.com>
Optichrome Computer Solutions Ltd
Maybury Road, Woking, Surrey, GU21 5HX, UK
Tel: +44 1483 740 233 Fax: +44 1483 760 644
http://www.optichrome.com
--------------------------------------------
More information about the Python-list
mailing list