> Daniel Dittmar wrote: > >- that suggest a different solution; like declarations on local > >variables that say "call destructor when object goes out of scope"
I did not follow all of this thread (that precise subject reoccurs once in a while, with some regularity), but I merely would like to point out that objects never go "out of scope". Only variables do, and variables hold references to objects. When the last reference to an object disappears, only then the destructor is called. With Python (that particular Python that some call C-Python), this is guaranteed. [Nick Coghlan] > You may be interested in PEP 310 (reliable acquisition/release pairs): > http://www.python.org/peps/pep-0310.html Such a PEP might be useful for Jython or other Python-like languages. Yet with Python, the real thing, the effect of the PEP is easily achieved by relying on the timely finalisation of objects. For example, in Pymacs, the `let' and other various `save-' constructs of Emacs Lisp are simulated through Let() objects, used like in this example: let = Let().push_excursion() if True : ... user code ... del let Here, the `if' sole-purpose is to indent the "with" block, and so, to make the whole construct more legible. -- François Pinard http://pinard.progiciels-bpi.ca -- http://mail.python.org/mailman/listinfo/python-list