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


Groups > comp.lang.python > #106773 > unrolled thread

Re: REMOVE ME

Started byChris Angelico <rosuav@gmail.com>
First post2016-04-10 13:52 +1000
Last post2016-04-10 13:52 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: REMOVE ME Chris Angelico <rosuav@gmail.com> - 2016-04-10 13:52 +1000

#106773 — Re: REMOVE ME

FromChris Angelico <rosuav@gmail.com>
Date2016-04-10 13:52 +1000
SubjectRe: REMOVE ME
Message-ID<mailman.2.1460260336.424.python-list@python.org>
On Sun, Apr 10, 2016 at 1:46 PM, fan nie <niefan68@gmail.com> wrote:
>
> --
> https://mail.python.org/mailman/listinfo/python-list

Sure. I presume you mean something like this:

class Thing:
    things = []
    def __init__(self):
        self.things.append(self)
    def __del__(self):
        # Remove me when I'm dead
        self.things.remove(self)

This ingenious technique guarantees that you never have dead objects
in your list, by having each object remove itself when it dies.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web