Creating class instance from module and class name

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Tue Oct 6 04:13:37 EDT 2009


gentlestone a écrit :

(snip)

> one more question - __class__ is the way for getting the classname
> from the class instance -

obj.__class__ is a reference to the class object itself, not it's name.

> how can I get the module name?

module_obj.__name__

And while we're at it: obj.__class__.__module__ might be of some 
interest too.




More information about the Python-list mailing list