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-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!feed.xsnews.nl!border-1.ams.xsnews.nl!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'distinct': 0.05; 'subject:position': 0.05; 'function,': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:string': 0.09; 'am,': 0.12; 'bytecode': 0.16; 'different,': 0.16; 'problem).': 0.16; 'subject:function': 0.16; 'wrote:': 0.18; '(which': 0.19; 'memory': 0.21; 'header:In-Reply-To:1': 0.22; 'objects,': 0.23; 'function': 0.27; 'compare': 0.28; '(and': 0.28; 'problem': 0.29; 'generally': 0.30; 'kelly': 0.30; 'subject:?': 0.31; "won't": 0.33; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'there': 0.33; 'object': 0.33; 'to:addr:python-list': 0.34; 'function.': 0.34; 'latter': 0.34; 'subject:How': 0.35; 'received:au': 0.36; 'comparing': 0.37; 'two': 0.37; 'but': 0.37; 'except': 0.37; 'think': 0.37; 'received:org': 0.38; 'subject:from': 0.38; 'difficult': 0.39; 'to:addr:python.org': 0.40; 'address': 0.61; 'lives': 0.63; 'due': 0.66; 'subject:name': 0.67; '08:48': 0.84; 'received:110': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Lie Ryan Subject: Re: How to get function string name from i-th stack position? Date: Sat, 31 Dec 2011 22:41:46 +1100 References: <00667d71-b9bc-411d-b2bc-0ead1d1468d7@g41g2000yqa.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 110-175-240-90.static.tpgi.com.au User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325331723 news.xs4all.nl 6958 [2001:888:2000:d::a6]:47174 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18250 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.