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?

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'distinct': 0.05; 'subject:position': 0.05; 'agree,': 0.07; 'function,': 0.07; 'subject:string': 0.09; 'am,': 0.12; 'subsequent': 0.15; 'bytecode': 0.16; 'different,': 0.16; 'general.': 0.16; 'problem).': 0.16; 'said.': 0.16; 'subject:function': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'ryan': 0.18; '(which': 0.19; 'cc:no real name:2**0': 0.20; 'memory': 0.21; 'trying': 0.21; 'dec': 0.22; 'header:In-Reply-To:1': 0.22; 'objects,': 0.23; 'cc:2**0': 0.24; 'received:74.125.82.174': 0.24; 'stack': 0.24; 'sat,': 0.25; 'function': 0.27; 'all,': 0.28; 'compare': 0.28; '(and': 0.28; 'message-id:@mail.gmail.com': 0.28; 'problem': 0.29; 'cc:addr:python.org': 0.29; 'generally': 0.30; 'kelly': 0.30; 'subject:?': 0.31; 'objects': 0.32; "won't": 0.33; 'there': 0.33; 'object': 0.33; 'function.': 0.34; 'latter': 0.34; 'lie': 0.34; 'received:74.125.82': 0.35; 'subject:How': 0.35; 'however,': 0.36; 'post': 0.36; 'comparing': 0.37; 'two': 0.37; 'but': 0.37; 'except': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'think': 0.37; 'subject:from': 0.38; 'difficult': 0.39; 'finding': 0.39; 'possible.': 0.39; '2011': 0.61; 'address': 0.61; 'lives': 0.63; '31,': 0.64; 'due': 0.66; 'subject:name': 0.67; '08:48': 0.84; 'summing': 0.84; 'sum': 0.89
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=lopHdSnjpWfONOLl323QbuFiJ1oPIM8W5z3naadWroQ=; b=SaXwKdoRN5MDDnaoyZMzic8pym1zkxLoYvNLVZqy8OXi4F/ZraWU3evN05Pm589IQW nnTQdgkPredzgLu3pFso2iJqQC93h7hlMUvNth143BPxcTiGHcQSx7C18PlHzzHZZhsc E7n1pxREyH+STXByOmvVNd/XlY/nZ1rO9nXww=
MIME-Version 1.0
In-Reply-To <jdmsds$c8$1@dough.gmane.org>
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 Sat, 31 Dec 2011 10:05:38 -0700
Subject Re: How to get function string name from i-th stack position?
To Lie Ryan <lie.1296@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4263.1325351176.27778.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325351176 news.xs4all.nl 6967 [2001:888:2000:d::a6]:57814
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18256

Show key headers only | 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