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


Groups > comp.lang.python > #65321

Re: __init__ is the initialiser

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'falls': 0.09; 'cc:addr :python-list': 0.11; 'def': 0.12; '__del__': 0.16; 'called.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'heap': 0.16; 'roy': 0.16; 'wrote:': 0.18; 'feb': 0.22; '>>>': 0.22; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'class': 0.32; 'skip:_ 10': 0.34; 'subject:the': 0.34; 'received:google.com': 0.35; 'object,': 0.36; 'method': 0.36; 'so,': 0.37; 'pm,': 0.38; 'does': 0.39; 'delete': 0.39; 'skip:p 20': 0.39; 'called': 0.40; "you're": 0.61; 'hear': 0.63; 'smith': 0.68; 'to:none': 0.92
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=PD7FyD2Wy7NHNhdIhrrMXPlYgc25vXuWHykIcHLwIGQ=; b=dBaNx59U3LSu0RCqrK03RioqEbBaYwWPcA2UgPP/oDDTBozOJiIpRozvnXzH2UFygF GZy09dojSxoK6EzjsrBM79+/BrjGWj4VdUkswQnnNM7N0Ak0+rNMHte8wXA0qPWkUk8y vqADmRKp40jHqIZdnywfX0SUrHNCJQMENcjDYR5WsvpvERQeEfv268HKZ9Wwf52udh+R /Hs7OMNfb+T0F/QUqzkFcpAElsajn8ezeH9gUztBIjsPedd+mZUzG9kYee0kmaJKnkBR Qd/ETh0spvJ3mM9A7kSn6V3/h4MdNnOXUCqpMmamFPC1SebXiDOyIJkHKikriSP+ztEq c5eQ==
MIME-Version 1.0
X-Received by 10.68.108.194 with SMTP id hm2mr35684186pbb.22.1391406593164; Sun, 02 Feb 2014 21:49:53 -0800 (PST)
In-Reply-To <roy-3D8A1A.00124503022014@news.panix.com>
References <lcgtpf$tui$1@ger.gmane.org> <lcgut2$b8r$1@ger.gmane.org> <858utviwgs.fsf@benfinney.id.au> <lchce7$44q$1@ger.gmane.org> <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> <CAPTjJmo4yS7CD2X2Cpi+ftx1fie4dSwUt_szgCO-BNpwK4kKOA@mail.gmail.com> <mailman.6316.1391387539.18130.python-list@python.org> <roy-873183.19454802022014@news.panix.com> <lcn1c0$k2g$2@ger.gmane.org> <CANc-5Uw0HpTSsy56zzh-FGuLK7eS2KiLW_bYwfFU2iPPFp9zBA@mail.gmail.com> <mailman.6325.1391403799.18130.python-list@python.org> <roy-3D8A1A.00124503022014@news.panix.com>
Date Mon, 3 Feb 2014 16:49:52 +1100
Subject Re: __init__ is the initialiser
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6326.1391406602.18130.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1391406602 news.xs4all.nl 2832 [2001:888:2000:d::a6]:36437
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:65321

Show key headers only | View raw


On Mon, Feb 3, 2014 at 4:12 PM, Roy Smith <roy@panix.com> wrote:
> So, what you're saying is when I delete an object, __del__() has both
> been called and not been called?

>>> class Schrodinger:
    def __init__(self):
        print("Init!")

>>> print(Schrodinger())
Init!
<__main__.Schrodinger object at 0x02B52570>

At this point, __del__ has indeed both been called and not been
called. However, observing its state will force it to collapse:

>>> class Schrodinger:
    def __init__(self):
        print("Init!")
    def __del__(self):
        print("Del!")

>>> print(Schrodinger())
Init!
<__main__.Schrodinger object at 0x02B52830>
Del!

If an object falls off the heap and there's no __del__ method to hear
it, does it call __del__?

ChrisA

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