Hi Philip,

On Sat, Mar 12, 2011 at 5:21 PM, Philip Jenvey <pjen...@underboss.org> wrote:
> Jython passes the first example. Shouldn't pypy's inplace_add__List_ANY be 
> returning NotImplemented (or whatever the pypy equiv. would be, 
> FailedToImplement?) instead of raising the exception? To allow the binop 
> rules to continue.

Good idea.  Right now, both on CPython and on PyPy,  [].__iadd__(5)
raises TypeError (instead of returning NotImplemented), but
[].__add__(5)  already behaves differently: it raises TypeError on
CPython and returns NotImplemented on PyPy, with the result that
[]+Bar()  does call the __radd__() method on Bar().  So having the
same difference in the __iadd__() method looks like a useful
compromise.  This is particularly true given that it already works on
all sequence types different from lists, because these don't have an
__iadd__() method at all.


Armin
_______________________________________________
pypy-dev@codespeak.net
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to