[pypy-dev] Compat. in 1.4.1 __del__

Dino Viehland dinov at microsoft.com
Sun Feb 6 06:04:37 CET 2011


Christianwrote:
> Howdy,
> 
> studying the differences of PyPy vs. CPython, most seem to be fine; one
> thing where I an unsure is the __del__ behavior.
> 
> I am not addressing its delayed call or the number it is called, this is similar to
> Jython and IronPython.
> 
> But assigning to __del__ after a class is created, is that so hard to implement?

IronPython also doesn't handle assigning to __del__ after the class is created, and
I'd be surprised if Jython did as well.  To make this work we'd need to maintain a 
weak reference for every object of a user defined type and I think most users 
would rather not pay that expense for such a corner case.  I've also never actually 
heard of this breaking compatibility anywhere. 

I'd say if this was really important to you then start off w/ a nop __del__.  Then you can
change __del_ to whatever you want later.  I'm not certain that would work w/ 
PyPy but I'd be surprised if it didn't - it will work w/ IronPython.



More information about the Pypy-dev mailing list