OOP - iterable class: how to delete one of its objects ?

R.Wieser address at not.available
Sat Nov 2 02:25:27 EDT 2019


Dennis,

> In __init__() you are adding "self" to a classwide list. So in
> your __del__() you need to remove the instance from the
> same list. Something

:-) Thats the problem: __del__ only gets called when the object is 
destroyed - which will never happen when the "instances" list still contains 
a reference to it.

Its a catch-22 situation: __del__ needs to be executed to remove the 
reference from the "instances" list, but I need to remove the reference from 
that list before __del__ will be called ...

Regards,
Rudy Wieser




More information about the Python-list mailing list