Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!amsnews11.chello.com!newsfeed.xs4all.nl!newsfeed5.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'cpython': 0.05; 'names.': 0.07; 'removes': 0.07; 'python': 0.08; '"a"': 0.09; 'ironpython': 0.09; 'subject:Extracting': 0.09; 'am,': 0.12; '16,': 0.15; 'language,': 0.15; 'this:': 0.15; '"del"': 0.16; '(assuming': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'initially,': 0.16; 'jython': 0.16; 'none"': 0.16; 'object).': 0.16; 'objects;': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'exists': 0.18; 'received:209.85.210.174': 0.18; 'received:mail- iy0-f174.google.com': 0.18; '(which': 0.19; 'trying': 0.21; "aren't": 0.21; 'maybe': 0.21; 'least,': 0.23; 'header:In-Reply- To:1': 0.23; 'there.': 0.24; "python's": 0.24; 'statement': 0.25; "i'm": 0.26; 'fact': 0.27; 'not.': 0.27; 'language.': 0.28; 'effect': 0.28; 'right.': 0.28; 'bound': 0.28; 'explicitly': 0.28; 'message-id:@mail.gmail.com': 0.29; 'behaves': 0.30; 'object.': 0.30; 'equivalent': 0.30; 'subject:?': 0.31; 'nov': 0.31; 'regardless': 0.31; 'objects': 0.32; 'does': 0.32; "isn't": 0.32; 'to:addr:python-list': 0.32; 'actually': 0.33; 'that,': 0.33; 'identical': 0.34; 'languages': 0.34; 'object': 0.35; 'connection': 0.36; 'explain': 0.36; 'subject:lists': 0.36; 'none': 0.36; 'but': 0.37; 'steven': 0.38; 'received:google.com': 0.38; 'some': 0.38; 'received:209.85': 0.38; "it's": 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.39; 'release': 0.40; 'delete': 0.40; 'far': 0.40; 'received:209': 0.40; '2011': 0.62; 'view': 0.65; 'here.': 0.66; 'roughly': 0.67; '"delete"': 0.84; 'subject:over': 0.84; 'spec': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=5EW7hsDRfa657JoZuq3WSb4jpx09NrmI2hf/vnbIb4E=; b=v6Pe0JXMcrlLqJ/Zioec2hicuYjgAvy/qV+wdThmPeZqipcNXgIaTcQxPaU+vY3vRv hpkBEz8mke2fv+d+0Y9nfVow5kl4B1SY8CP4e81PaSPOj5jaH63IPFl2cA0ZCcqe0Xts D4MBl+v+KNYPfxgkaNt3CDTM8sJgv3DlwboSE= MIME-Version: 1.0 In-Reply-To: <4ec2e6cb$0$29970$c3e8da3$5496439d@news.astraweb.com> References: <4EB828B3.1020509@sequans.com> <5B80DD153D7D744689F57F4FB69AF4740182FE@SCACMX008.exchad.jpmchase.net> <4EC2ACCC.2000100@davea.name> <4ec2e6cb$0$29970$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 16 Nov 2011 09:54:15 +1100 Subject: Re: Extracting elements over multiple lists? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1321397658 news.xs4all.nl 6892 [2001:888:2000:d::a6]:50736 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:15750 On Wed, Nov 16, 2011 at 9:25 AM, Steven D'Aprano wrote: > Languages aren't refcounted. Or at least, *Python* isn't a refcounted > language. CPython is a refcounted implementation. IronPython and Jython > are not. del behaves exactly the same in IronPython and Jython as it does > in CPython: it removes the name, which may have a side-effect of deleting > the object. Yes, I was sloppy there. A non-manually-memory-managed language, if you will; it's part of Python's spec that you do NOT have to explicitly release objects you're no longer using. >> The del >> statement is identical to "a =3D None" in terms of deleting objects; > > I'm not entirely sure what you arr trying to say here. I *think* you are > trying to say is this: > > =A0 =A0Given that `a` is bound to my_object initially, `del a` > =A0 =A0from the point of view of my_object is no different > =A0 =A0from re-binding a to some other object such as None > =A0 =A0(or any other object). > > which is true as far as it goes, but it fails to note that the name "a" > no longer exists after `del a` while it does exist after `a =3D None`. Right. Both actions have the same effect wrt deleting my_object; the only connection between Python's "del" and C++'s "delete" is that, which del shares with "a =3D None". The fact is that, regardless of the Python implementation, deleting *objects* is not the programmer's responsibility. The only thing he can or must do is delete *names*. del a del globals()['a'] globals().__delitem__('a') are all roughly equivalent (assuming that a is global). Maybe this is the best way to explain it - that you're deleting from a "dictionary" (which may or may not actually be implemented as a dict) of local names. ChrisA