Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'assuming': 0.09; 'received:internal': 0.09; 'subject:while': 0.09; 'def': 0.12; '(1,': 0.16; 'does,': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'subject:recursion': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'tuple': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; "d'aprano": 0.31; 'steven': 0.31; 'received:66': 0.35; 'case,': 0.35; 'test': 0.35; 'but': 0.35; 'received:10': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'from:no real name:2**0': 0.61; 'simple': 0.61; 'header:Message-Id:1': 0.63; 'show': 0.63; 'fact,': 0.69; 'you:': 0.81; '2013,': 0.91 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:from:to:mime-version:content-transfer-encoding :content-type:subject:date:in-reply-to:references; s=mesmtp; bh= D9RA0w4zk9PPC6FD8HJAtwruYiM=; b=UNCnMd6+3M8Y+WMxQ+7smu4DinRKmaAr 5AEMMDaSLKOVfHXmI9uiTjQjFg0Ddh1U9i3fXOAqR9BEdRz9G5nw/8k6GQl2lpN7 hl5oVC4t759M3AxBwCQj+eTfzB08OrcVKPG7ZAy84s0jJIMx1IdskAy7mwXT9nW4 RRdt1/kMsfc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:subject:date:in-reply-to :references; s=smtpout; bh=D9RA0w4zk9PPC6FD8HJAtwruYiM=; b=RwAv6 f7poWYIXtahZ2sC1fX24Wq+iNs5l0M2TNQDWXDpWLij9cfUVM8d+IU1tiUjOzmha lNwlHP3/WZHFLi62SsdtaFCPn2WOif2Zav+V2uH9EAnS1xFDVmMKZ1jGMUbctBsn IlwqO311itxJ1Ty+i1q1YWak7veHVxXitaTGag= X-Sasl-Enc: SSeqeOMANfScR+Y8OujVu53Wq/hbKsWaM9b2x44JjipN 1380809789 From: random832@fastmail.us To: "Steven D'Aprano" , python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-ce174988 Subject: Re: Tail recursion to while iteration in 2 easy steps Date: Thu, 03 Oct 2013 10:16:29 -0400 In-Reply-To: <524cd7a7$0$29984$c3e8da3$5496439d@news.astraweb.com> References: <87had0axxy.fsf@dpt-info.u-strasbg.fr> <524cc73a$0$29984$c3e8da3$5496439d@news.astraweb.com> <524cd7a7$0$29984$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1380809791 news.xs4all.nl 15928 [2001:888:2000:d::a6]:56958 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:55413 On Wed, Oct 2, 2013, at 22:34, Steven D'Aprano wrote: > You are both assuming that LOAD_CONST will re-use the same tuple > (1, 2, 3) in multiple places. But that's not the case, as a simple test > will show you: >>> def f(): ... return (1, 2, 3) >>> f() is f() True It does, in fact, re-use it when it is _the same LOAD_CONST instruction_.