Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'scripts': 0.03; 'cpython': 0.05; 'string': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'foo()': 0.16; 'object()': 0.16; 'objects.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'all.': 0.16; 'bit': 0.19; 'thanks.': 0.20; '>>>': 0.22; 'example': 0.22; 'header:User- Agent:1': 0.23; 'either.': 0.24; 'skip:" 30': 0.26; 'this:': 0.26; 'pass': 0.26; 'header:X-Complaints-To:1': 0.27; 'wondering': 0.29; 'getting': 0.31; 'them?': 0.31; 'class': 0.32; 'could': 0.34; 'objects': 0.35; 'but': 0.35; 'false': 0.36; 'shows': 0.36; 'subject:?': 0.36; 'detail': 0.37; 'list': 0.37; 'to:addr:python- list': 0.38; 'explain': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'first': 0.61; 'such': 0.63; 'more': 0.64; 'received:46': 0.66; 'here': 0.66; '3.4': 0.84; 'subject:skip:g 10': 0.84; 'charset:windows-1250': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: =?windows-1250?Q?Jurko_Gospodneti=E6?= Subject: What does gc.get_objects() return? Date: Wed, 12 Mar 2014 20:34:16 +0100 Organization: PKE sistemi d.o.o. Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1250; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 46.188.175.241 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394652868 news.xs4all.nl 2939 [2001:888:2000:d::a6]:34381 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68292 Hi all. I was wondering if someone could explain gc.get_objects() in a bit more detail to me. Does it return a list of 'all objects known to Python'? Only some of them? Which does it return? Which it does not? For example (done using CPython 3.4 interactive interpreter) here it does not contain an object I know exists: > >>> a = object() > >>> a in gc.get_objects() > False but here it does: > >>> class Foo: pass > ... > >>> a = Foo() > >>> a in gc.get_objects() > True It also does not seem to contain string objects. At first I thought that perhaps interned strings were not placed under GC control, so I tested this: > >>> a = "asdkjfhk23498237$&(*$&*($ksjdhfkjsd" > >>> b = "asdkjfhk23498237$&(*$&*($ksjdhfkjsd" > >>> a is b > False > >>> a in gc.get_objects() > False > >>> b in gc.get_objects() > False Which shows that non-interned scripts such as these are not getting listed in gc.get_objects() either. :-s Many thanks. Best regards, Jurko Gospodnetiæ