does python have useless destructors?

Paul Rubin http
Fri Jun 11 22:38:38 CEST 2004

David Bolen <db3l at> writes:
> It lets you write code like:
>         void some_function(void) {
>             Lock_object lock(some_parms);
>             - do something needing the lock -
>         }

There's a PEP for something like that in Python:

I think that's greatly preferable to dictating that the GC system act
a certain way and free resources as soon as they go out of scope.
That's just not the correct semantics for GC.  GC should simply create
the illusion for the application that all objects stay around forever.

More information about the Python-list mailing list