Get "code object" of class

Okko Willeboordse trash at willeboordse.demon.nl
Fri Oct 10 08:50:23 EDT 2008


To get the "code object" c of my_class I can do;

c = compile(inspect.getsource(my_class), "<script>", "exec")

This fails when inspect can't get hold of the source of my_class,
for instance when my_class is in a pyc file.


Is there another way of getting c?



More information about the Python-list mailing list