Hello all,

I've created a class from which I can iterate all its instanciated objects 
(using an "instances" list).    The problem is that I now cannot seem to 
delete an object anymore, AFAIK as a copy of its "self" is still inside the 
"instances" list.

Object in question:
- - - - - - - - - - - - - - - -
class TheObject:
    instances = []

    def __init__(self):
        self.instances.append(self)

    def __del__(self):
        print("Deleted!")
- - - - - - - - - - - - - - - -

The question: How can I keep the class iterable, but still have it delete 
itself when asked.

Regards,
Rudy Wieser


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to