How to get function string name from i-th stack position?

Lie Ryan lie.1296 at gmail.com
Sat Dec 31 06:41:46 EST 2011


On 12/31/2011 08:48 AM, Ian Kelly wrote:
>
> But they are two distinct function objects, and there is no way
> programmatically to determine that they are the same function except
> by comparing the bytecode (which won't work generally because of the
> halting problem).

Actually, it is often possible to determine that two functions are the 
same function, you simply need a to compare whether the function object 
lives in the same memory address. It is also possible to determine if 
two functions are different, if the function object are in different 
memory address than the function is different function.

What is difficult to do due to the Halting problem is comparing whether 
two different functions are "equivalent" (and therefore interchangeable).

I think the OP wants to find the former, not the latter. The former is 
trivial, the latter impossible.




More information about the Python-list mailing list