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


Groups > comp.lang.python > #106897

Re: REMOVE ME

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: REMOVE ME
Date 2016-04-12 10:44 +1000
Message-ID <mailman.40.1460421909.15650.python-list@python.org> (permalink)
References (1 earlier) <CAPTjJmrdgBsSWUkNi+H8Tm8eqHA53pxVM-FP8ChqsxRNCeRNGA@mail.gmail.com> <570C28C9.3090103@o2.co.uk> <mailman.36.1460414670.15650.python-list@python.org> <570c2f00$0$1608$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmrabYEELZ6nV9ZDtQn=vVwkX_jN6+oc2y+aRPMpddCbBQ@mail.gmail.com>

Show all headers | View raw


On Tue, Apr 12, 2016 at 9:10 AM, Steven D'Aprano <steve@pearwood.info> wrote:
> Hence "self.things" will return the same
> list each time, the one defined as a class attribute, regardless of
> which "self" does the lookup.
>
> If a method were to assign to the attribute, for example "self.things = []",
> that would create an instance attribute, but that doesn't happen.

Indeed. And the __del__ method is guaranteed always to raise an
exception; by the time __del__ gets called, there can't be any
references to the object anywhere, so it can't be in that list any
more...

ChrisA

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


Thread

Re: REMOVE ME John Pote <johnhpote@o2.co.uk> - 2016-04-11 23:44 +0100
  Re: REMOVE ME Steven D'Aprano <steve@pearwood.info> - 2016-04-12 09:10 +1000
    Re: REMOVE ME Chris Angelico <rosuav@gmail.com> - 2016-04-12 10:44 +1000

csiph-web