Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18256

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

References <00667d71-b9bc-411d-b2bc-0ead1d1468d7@g41g2000yqa.googlegroups.com> <mailman.4250.1325270163.27778.python-list@python.org> <a9e70268-ee24-4d18-abe2-e994e326be9c@d9g2000yqg.googlegroups.com> <CALwzidnRiFPxubAmnaWeE014djs+ECuvOGHtxXzJdy7CBjSzUw@mail.gmail.com> <jdmsds$c8$1@dough.gmane.org>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2011-12-31 10:05 -0700
Subject Re: How to get function string name from i-th stack position?
Newsgroups comp.lang.python
Message-ID <mailman.4263.1325351176.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Dec 31, 2011 at 4:41 AM, Lie Ryan <lie.1296@gmail.com> wrote:
> 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).

Yes, that is what I said.  You can determine whether two function
objects are the same, but not whether they are *mathematically* the
same function.

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

Based on his subsequent clarification, I agree, although from his
original post it sounded like he was just trying to identify summing
functions in general.   However, finding the built-in sum function on
the stack is not trivial at all, perhaps not even possible.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How to get function string name from i-th stack position? dmitrey <dmitrey15@gmail.com> - 2011-12-30 09:51 -0800
  Re: How to get function string name from i-th stack position? Tim Chase <python.list@tim.thechases.com> - 2011-12-30 12:35 -0600
    Re: How to get function string name from i-th stack position? dmitrey <dmitrey15@gmail.com> - 2011-12-30 10:43 -0800
      Re: How to get function string name from i-th stack position? Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-30 14:48 -0700
        Re: How to get function string name from i-th stack position? dmitrey <dmitrey15@gmail.com> - 2011-12-31 00:44 -0800
          Re: How to get function string name from i-th stack position? Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-31 10:13 -0700
      Re: How to get function string name from i-th stack position? Lie Ryan <lie.1296@gmail.com> - 2011-12-31 22:41 +1100
      Re: How to get function string name from i-th stack position? Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-31 10:05 -0700

csiph-web