determining the source code and module based on the class

alf ask at me
Mon Jul 16 00:55:26 EDT 2007


Hi,

Let's say I have a class defined somewhere:

class A:
    pass



now I import (indirectly) a module defining that class (and in fact 
thousands of others defined in hundreds of modules) where all I have is 
a list of them provided:

l=[A,B,C]


now I need a piece of code which based on the class name can point to 
the module as well as the line number where the given class is defined.

Is it doable in Python?


-- 
alf



More information about the Python-list mailing list