does python have useless destructors?

David Turner dkturner at
Tue Jun 15 10:04:22 CEST 2004

> >
> >It's pretty darn hard to mess something like this up.  So yes, you
> >*can* use heap-based objects as RAII containers.
> It's pretty darn easy: what happens when you pass those pointers outside
> of their stack holders?  That's a *normal* part of Python programming;
> changing that requires a whole new paradigm.

What happens is that you get an extra reference to it, just as you'd
expect.  When that reference is released, the file closes.

So, no new paradigms there then.

David Turner

More information about the Python-list mailing list