Bug in Getsource?

Chris S. chrisks at NOSPAMudel.edu
Tue Jun 22 17:04:02 EDT 2004


I've noticed inspect.getsource acts strangely for lambda expressions. 
For instance:

from inspect import getsource
somefunc = lambda(a):abs(a)
print 'somefunc source:',getsource(somefunc)

results in:

somefunc source: from inspect import getsource

I'd understand if inspect can't handle lambda expressions, but claiming 
something is an object's source when it is obviously not is a bug IMO. 
Is this correct? Is there any way to fix this?



More information about the Python-list mailing list