Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'subsequent': 0.05; 'canvas': 0.07; 'explicit': 0.07; 'bits': 0.09; 'forcing': 0.09; 'referenced': 0.09; 'useless': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'ctypes.': 0.16; 'fire,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'object()': 0.16; 'roy': 0.16; 'scrub': 0.16; 'throw': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'stack': 0.19; 'feb': 0.22; '>>>': 0.22; 'manual': 0.22; 'cc:addr:python.org': 0.22; 'pointer': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'references': 0.26; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; '[1]': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '"",': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'file': 0.32; '(most': 0.33; 'subject:the': 0.34; 'anywhere': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'ram': 0.36; 'possible': 0.36; 'list': 0.37; 'recent': 0.39; 'does': 0.39; 'catch': 0.60; 'fire': 0.65; 'here': 0.66; 'smith': 0.68; 'article': 0.77; 'lack': 0.78; 'attacking': 0.84; 'to:none': 0.92; 'serious': 0.97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=FZ3UD6lI8daCtrCAa6wjzma8w63XUzmQAVjbIJ/Yzlg=; b=OgxE/R+YgfY/JvT5t1js2VZBPLo0OdBg1muYnyrwfNLA/kcoPP4alGi/Kz7MBydVf7 gfKEZB9425RC+a4rUM4wlodgU1du8cxF1nb1DBzzIV45O04Td9gHwzOIopx17OzlSZ46 gCompFHnz0/3ZyN2BRpIaXcaO74jEFjmow2IGyzD7sx5Rt93Rsrp9H+tEwM8TmwuLIJ6 tQ+g4bbkUG9LRbbIzqxHWUlSXaSe1VITx0cB/Max+j/IEsfwOjI/NwtYP3rbiN8gcWqi nv4Othb7DAbv9XzkEj/Ei2chuUiRI62LXx2f4OGLthAQHbyv1uCPtvwflDKew5PslByl zoKg== MIME-Version: 1.0 X-Received: by 10.68.244.103 with SMTP id xf7mr33988940pbc.50.1391383671606; Sun, 02 Feb 2014 15:27:51 -0800 (PST) In-Reply-To: References: <858utviwgs.fsf@benfinney.id.au> <52EC3C40.7080402@stoneleaf.us> <52ec84bc$0$29972$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 3 Feb 2014 10:27:51 +1100 Subject: Re: __init__ is the initialiser From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391383680 news.xs4all.nl 2965 [2001:888:2000:d::a6]:54937 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65294 On Mon, Feb 3, 2014 at 10:15 AM, Gregory Ewing wrote: > Roy Smith wrote: >> >> In article <52ec84bc$0$29972$c3e8da3$5496439d@news.astraweb.com>, >> Steven D'Aprano wrote: >> >>> A dubious analogy, since there are artists who would say that attacking >>> the canvas with a knife and setting the remains on fire count as a form of >>> artistic creation :-) >> >> >> That's __del__() > > > But it only works if the canvas is not referenced > anywhere in any art catalogues. Otherwise the > canvas fails to catch fire, and gets put on a > list of list of artworks to be considered for > manual incineration. What you see here is proof that Python really does need an explicit destroy() function. It would need to recycle the object [1], forcing all references to it to dangle: >>> a = object() >>> b = a >>> destroy(a) >>> c = b Traceback (most recent call last): File "", line 1, in c = b SegmentationError: dereferencing a dangling pointer It's a serious lack in Python. Currently it's not possible to do this without fiddling around in ctypes. ChrisA [1] Scrub the RAM clean and return it to the computer, put the 1 bits onto the stack for subsequent reuse, and throw all the useless 0 bits out onto the heap.