Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65294

Re: __init__ is the initialiser

References (4 earlier) <52EC3C40.7080402@stoneleaf.us> <mailman.6251.1391224639.18130.python-list@python.org> <52ec84bc$0$29972$c3e8da3$5496439d@news.astraweb.com> <roy-5740C1.00250401022014@news.panix.com> <bl81skFh14iU1@mid.individual.net>
Date 2014-02-03 10:27 +1100
Subject Re: __init__ is the initialiser
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.6313.1391383680.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Feb 3, 2014 at 10:15 AM, Gregory Ewing
<greg.ewing@canterbury.ac.nz> wrote:
> Roy Smith wrote:
>>
>> In article <52ec84bc$0$29972$c3e8da3$5496439d@news.astraweb.com>,
>>  Steven D'Aprano <steve+comp.lang.python@pearwood.info> 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 "<pyshell#89>", line 1, in <module>
    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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: __init__ is the initialiser Terry Reedy <tjreedy@udel.edu> - 2014-01-31 22:16 -0500
  Re: __init__ is the initialiser Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-01 05:23 +0000
    Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-01 00:25 -0500
      Re: __init__ is the initialiser Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-02-03 12:15 +1300
        Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 10:27 +1100
          Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-02 18:40 -0500
            Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 11:07 +1100
            Re: __init__ is the initialiser Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-02-02 17:24 -0800
            Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 12:37 +1100
            Re: __init__ is the initialiser Devin Jeanpierre <jeanpierreda@gmail.com> - 2014-02-02 17:54 -0800
            Re: __init__ is the initialiser Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-03 08:44 -0500
            Re: __init__ is the initialiser Nicholas Cole <nicholas.cole@gmail.com> - 2014-02-03 13:50 +0000
            Re: __init__ is the initialiser Ian Kelly <ian.g.kelly@gmail.com> - 2014-02-03 10:44 -0700
            Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-04 04:57 +1100
            Re: __init__ is the initialiser Nicholas Cole <nicholas.cole@gmail.com> - 2014-02-03 19:57 +0000
            Re: __init__ is the initialiser Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-02-03 19:38 -0500
        Re: __init__ is the initialiser Dave Angel <davea@davea.name> - 2014-02-02 19:35 -0500
          Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-02 19:45 -0500
            Re: __init__ is the initialiser Dave Angel <davea@davea.name> - 2014-02-02 22:14 -0500
            Re: __init__ is the initialiser Skip Montanaro <skip@pobox.com> - 2014-02-02 21:15 -0600
            Re: __init__ is the initialiser Dave Angel <davea@davea.name> - 2014-02-03 00:06 -0500
              Re: __init__ is the initialiser Roy Smith <roy@panix.com> - 2014-02-03 00:12 -0500
                Re: __init__ is the initialiser Chris Angelico <rosuav@gmail.com> - 2014-02-03 16:49 +1100
                Re: __init__ is the initialiser Ethan Furman <ethan@stoneleaf.us> - 2014-02-02 21:34 -0800
    Re: __init__ is the initialiser Rustom Mody <rustompmody@gmail.com> - 2014-01-31 21:31 -0800

csiph-web