[Python-Dev] Re: Object finalization for local (ie function) scopes

David Abrahams dave at boost-consulting.com
Sat Jun 12 08:18:20 EDT 2004

"Martin v. Löwis" <martin at v.loewis.de> writes:

> Oliver Schoenborn wrote:
>> I can accept that only if there is something inherent to the technique which
>> exploits a non-specified aspect of the language. I can't think of any. Could
>> you be more specific about what aspect is not portable?
> The idea that you can execute code at the end of a function to invoke
> teardown operations, even in the presence of exceptions. That cannot be
> done for Jython, AFAIK. Jython generates Java byte code from Python
> source code, so there is no Python virtual machine anywhere.

I'm sure I missed something important along the way here, but the fact
that you can generate Java bytecode for Python's "finally" in Jython,
it seems to me, _proves_ that you can also generate code to that will
be executed at the end of a function even in the presence of

Dave Abrahams
Boost Consulting

More information about the Python-Dev mailing list