Generator inside a class prevent __del__ ??

Emmanuel eastier at free.fr
Wed Apr 21 19:26:18 EDT 2004



Andrew Bennetts a écrit :

> On Wed, Apr 21, 2004 at 02:53:33PM +0200, Emmanuel wrote:
> >
> > Trouble is, I _would_ like not to care about the lifetime of the object, and I
> > don't know where it will be destroyed.
>
> Then don't use __del__.  Python can and will automatically collect cycles
> when the objects *don't* define __del__ methods.
>
> Out of curiousity, why are you defining __del__ anyway?
>
> -Andrew.



I don't want to use __del__, but I suspected I had an issue with the destruction of
my objects, and used a log in __del__ to monitor the destruction.

But defining __del__ has also a lot of valuable utilisation, or so I think...

Emmanuel





More information about the Python-list mailing list