On Sun, Apr 10, 2016 at 1:46 PM, fan nie <[email protected]> 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
--
https://mail.python.org/mailman/listinfo/python-list