does python have useless destructors?

Aahz aahz at pythoncraft.com
Sun Jun 13 23:43:58 EDT 2004


In article <e251b7ba.0406120221.15e75e9b at posting.google.com>,
David Turner <dkturner at telkomsa.net> wrote:
>
>The huge advantage that the RAII approach holds in this respect is
>that the user of the library just does what comes naturally - for
>example, he declares a file object and uses it.  He would have done
>that anyway.  He doesn't need to know whether or not it's a RAII
>object that needs a "with" or "using" or "dispose" or "try/finally"
>clause.

Do you know any RAII approach that does not depend on stack-based locals
semantics?  Python's global objects are extremely useful, and unless you
want to essentially create a new language, anything remotely resembling
pure RAII in the language core won't work.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"as long as we like the same operating system, things are cool." --piranha



More information about the Python-list mailing list