greg.ewing at compaq.com
Thu Jun 17 22:00:32 EDT 1999
> If I'm passed a reference is there a way to get its vital information like
> name, filename, line number.... ?
If x is an instance of a class, then sys.modules[x.__class__.__module__]
will give you the module that the class was defined in; from there,
__file__ gives you the file name (but not the line number, as far as I
If f is a function, then f.func_code has attributes co_filename and
I don't think there's anything you can find out about the source
of any other kind of object.
More information about the Python-list