This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: __add__ returning NotImplemented broken
Type: Stage:
Components: Interpreter Core Versions: Python 2.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, mwh
Priority: high Keywords:

Created on 2002-03-04 15:38 by gvanrossum, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (3)
msg9502 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-03-04 15:38
A new-style class that returns NotImplemented
from its __add__ method misbehaves; this should
raise a TypeError but in fact the NotImplemented
value is kept as the return value.

This only seems to be a problem with __add__;
I bet it's because the code goes through a path
intended for sequence concatenation.

Old-style classes do the right thing.
msg9503 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2002-03-11 10:10
Logged In: YES 
user_id=6656

Isn't this a dup of 

[ 516727 ] MyInt(2)+"3" -> NotImplemented

? (now fixed in CVS)
msg9504 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-03-11 13:14
Logged In: YES 
user_id=6380

Yup. Closing.
History
Date User Action Args
2022-04-10 16:05:03adminsetgithub: 36198
2002-03-04 15:38:50gvanrossumcreate