does python have useless destructors?

David Turner dkturner at telkomsa.net
Tue Jun 15 04:04:22 EDT 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.

Regards
David Turner



More information about the Python-list mailing list