Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.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.052 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'cpython': 0.05; 'integers': 0.09; 'at)': 0.16; 'tuple': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; '(in': 0.22; 'possibly': 0.26; 'references': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'with,': 0.31; 'could': 0.34; "can't": 0.35; 'something': 0.35; 'done.': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'false': 0.36; 'done': 0.36; 'subject:?': 0.36; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'anything': 0.39; '12,': 0.39; 'itself': 0.39; 'to:addr:python.org': 0.39; 'worth': 0.66; 'mar': 0.68; 'subject:skip:g 10': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=EBkcXKhBbqH8vkaE7XYYMyVypw0UyhOSxUTTnKao/gE=; b=GomUt1lgWmsiyS6w1tIXinUaawC62wynqsLeFcEswjq44ZB+xzZb0L28YwVCSlAgJQ TzgWCGZm+ypXWmafURWe/nmEy23iYF6EVsOI8lxjoUBoc/zpRjhwCNs+1iw9WsH1UeWK W7ai8X9YIh4KBDjISnLPOUV7fyC28ghtQgsFRaoN5r8sW6qChBFI10LqUwMufSTANt4t PVEO5fltReOAwLYkU4cjosdXZmyfZOmxbnCqbg0xjzCEERliU0CCCPEFlOZVsdN8RaOx aQEWyXAtDlckt1z8DKBZ+9+VAT2pjZnHNbp1Hr6MtCVx6aqCHrGJNHinmy8aq86jDkFL nOHw== X-Received: by 10.68.134.198 with SMTP id pm6mr43922pbb.9.1394663753707; Wed, 12 Mar 2014 15:35:53 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <5320BD3F.5030509@mrabarnett.plus.com> From: Ian Kelly Date: Wed, 12 Mar 2014 16:35:13 -0600 Subject: Re: What does gc.get_objects() return? To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394663762 news.xs4all.nl 2870 [2001:888:2000:d::a6]:34743 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68302 On Wed, Mar 12, 2014 at 3:44 PM, Chris Angelico wrote: > The concept is that the GC tracks (in that sense; everything in > CPython is refcounted, but that's not what these functions look at) > anything that could be a part of a reference cycle. That's all it > concerns itself with, so something that can't have references to > arbitrary objects can't possibly be worth tracking. Interestingly, a > tuple of integers is tracked: > >>>> a=1,2,3 >>>> gc.is_tracked(a) > True > > So not all optimizations are done that could be done. Or is it? >>> a = 1,2,3 >>> gc.is_tracked(a) True >>> gc.collect() 0 >>> gc.is_tracked(a) False