Barry A. Warsaw
bwarsaw at cnri.reston.va.us
Thu Jun 3 14:55:47 EDT 1999
>>>>> "HN" == Hrvoje Niksic <hniksic at srce.hr> writes:
HN> Isn't that a case of sacrificing (Python) correctness for
HN> (Java) efficiency? The code that relies on __del__() getting
HN> called eventually will lose in JPython.
You're right. In this specific case it's probably worth it, since Jim
reported a 10x performance hit when PyInstance.finalize() was defined.
Given that JVMs probably won't make finalize() an order of magnitude
more efficient any time soon, and given that most Python classes don't
use __del__() it makes sense that PyInstance has no finalize()
method. The right approach would be to create a subclass of
PyInstance (say called PyFinalizingInstance) which /does/ call
__del__() and then create one of these when building a class that has
a __del__ defined.
I haven't thought it through completely, and its definitely not on my
personal radar scope for near-term JPython development, but I do at
least plan to document this difference between CPython and JPython.
More information about the Python-list