does python have useless destructors?

David Turner dkturner at telkomsa.net
Mon Jun 21 10:08:54 CEST 2004


aahz at pythoncraft.com (Aahz) wrote in message news:<caubvv$78n$1 at panix3.panix.com>...
> >> Not really.  Problem is that there's nothing to prevent people from
> >> passing File.fh outside the loop -- and that's standard Python coding
> >> technique!  For that matter, there's nothing preventing a File()
> >> instance from being passed around.  The fact that you've created an
> >> idiom that you want to behave like a similar C idiom has nothing to do
> >> with the way Python actually works.
> >
> >You can do exactly the same thing in the C++ version, and regularly
> >do.  What's your point?
> 
> And how does your destructor work when you do that?

Just fine, thank you.  It does exactly what I expect it to - runs when
the last reference disappears.

What did you expect?

Regards
David Turner



More information about the Python-list mailing list