how to get id(function) for each function in stack?

Lie Ryan lie.1296 at gmail.com
Fri Jan 6 19:17:38 EST 2012


On 01/07/2012 06:50 AM, Ian Kelly wrote:
> On Fri, Jan 6, 2012 at 12:29 PM, dmitrey<dmitrey15 at gmail.com>  wrote:
>> Python build-in function sum() has no attribute func_code, what should
>> I do in the case?
>
> Built-in functions and C extension functions have no code objects, and
> for that reason they also do not exist in the stack.  There is no way
> to find sum() in the Python stack, because it isn't there.

a practical solution to this issue is to wrap the C functions in Python 
functions. You lose some speed but that might be an acceptable tradeoff 
in some situations (especially if you're only wrapping when debugging).




More information about the Python-list mailing list