REMOVE ME

Chris Angelico rosuav at gmail.com
Mon Apr 11 20:44:59 EDT 2016


On Tue, Apr 12, 2016 at 9:10 AM, Steven D'Aprano <steve at 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



More information about the Python-list mailing list