does python have useless destructors?

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Tue Jun 15 01:44:39 CEST 2004


David Turner wrote:

> This will be a pain for the Jython implementers.  However, it is
> doable.  Note that I never said the objects couldn't be garbage
> collected, just that __del__ had to be called at certain well-defined
> times.  What this will involve is the Jython compiler inserting a lot
> of implicit try/finally constructs.
> 
> Can anyone see a reason why this scheme wouldn't work?

Yes - Jython cannot know about references to objects created *in Java
code*. It is therefore impossible for Jython to maintain reference
counts when an object is passed to Java (i.e. non-Python) code.

Tim Delaney




More information about the Python-list mailing list