Get path of a class
Peter Hansen
peter at engcorp.com
Tue Jan 10 11:21:54 EST 2006
Florian Lindner wrote:
> Hello,
> how can I get the path of a class. I managed to do it with
>
> c.__module__ + "." + c.__name__
>
> but I'm sure there is a better way.
Please define what you mean by "path" (and how you hope to make use of
this information).
Generally a module has a "path" (i.e. a location where it can be loaded
from the file system) but classes are merely created by "class"
statements within a module. There is no one-to-one match with files,
and in fact no requirement that a class even be traceable directly to
statements in a source file.
-Peter
More information about the Python-list
mailing list