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

Rhodri James rhodri at kynesim.co.uk
Mon Nov 4 08:44:22 EST 2019


On 02/11/2019 06:30, R.Wieser wrote:
> Rhodri,
> 
>> Use weak references.  A WeakSet
>> (https://docs.python.org/3/library/weakref.html#weakref.WeakSet) is
>> probably what you want.
> 
> Most likely!    As a fresh freshling in regard to python I was not even
> aware that a "copy object, but do not increment the reference count"
> existed.    Thank you.
> 
> Could cause some interresting "the object has disappeared!" problems when
> you're not carefull with it though ... :-)

Yes, it can.  That's why you want to create a finalizer to tidy up.

-- 
Rhodri James *-* Kynesim Ltd


More information about the Python-list mailing list