Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'function,': 0.07; 'list?': 0.07; 'objects,': 0.07; "'''": 0.09; 'immutable': 0.09; 'objects.': 0.09; 'subject:set': 0.09; 'terms,': 0.09; 'tuple': 0.09; 'above?': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'immutable,': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'references': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'consisting': 0.29; 'detector': 0.29; 'received:192.168.1.3': 0.29; 'lists': 0.31; 'implement': 0.32; 'to:addr:python-list': 0.33; 'another': 0.33; 'or,': 0.34; 'list': 0.35; 'apply.': 0.35; 'add': 0.36; 'created': 0.36; 'but': 0.36; 'turn': 0.36; 'possible': 0.37; 'does': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'help': 0.40; 'thomas': 0.62; 'more': 0.63; 'note:': 0.64; 'charset:windows-1252': 0.65; 'therefore': 0.65; 'header:Reply-To:1': 0.68; 'direct': 0.69; 'reply-to:no real name:2**0': 0.72; 'indirect': 0.84; 'it\x92s': 0.84; 'rachel': 0.84; 'reply-to:addr:python.org': 0.84; 'was:': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.0 cv=W6e6pGqk c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=lR6CHUT36vYA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=N659UExz7-8A:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=Ns7uWrT23YMA:10 a=TKwEb9KKHyJ1hMt-60oA:9 a=pILNOxqGKmIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 X-AUTH: mrabarnett:2500 Date: Sat, 08 Sep 2012 22:22:55 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20120824 Thunderbird/15.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: set and dict iteration References: <7xy5le7cli.fsf@ruckus.brouhaha.com> <502dab6c$0$29978$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347139563 news.xs4all.nl 6921 [2001:888:2000:d::a6]:46763 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28746 On 08/09/2012 21:06, Thomas Rachel wrote: > Am 19.08.2012 00:14 schrieb MRAB: > >>> Can someone who is more familiar with the cycle detector and cycle >>> breaker, help prove or disprove the above? >>> >> In simple terms, when you create an immutable object it can contain >> only references to pre-existing objects, but in order to create a cycle >> you need to make an object refer to another which is created later, so >> it's not possible to create a cycle out of immutable objects. > > Yes, but if I add a list in-between, I can create a refcycle: > > a = [] > b = (a,) > a.append(b) > > So b is a tuple consisting of one list which in turn contains b. > > It is not a direct cycle, but an indirect one. > > Or would that be detected via the list? > The quote was: ''' ...The tuple type does not implement a tp_clear function, because it’s possible to prove that no reference cycle can be composed entirely of tuples. ''' Note: "composed entirely of tuples". Or, in general, composed entirely of immutables. Lists are not immutable, therefore the proof does not apply.