Bugs item #847024, was opened at 2003-11-22 02:39 Message generated for change (Comment added) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=847024&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Type/class unification Group: Python 2.3 >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Michael Dubner (dubnerm) Assigned to: Michael Hudson (mwh) Summary: NotImplemented return value misinterpreted in new classes Initial Comment: Following program: ------------------------------ notimpl.py class CClassic: def __add__(self, other): return NotImplemented def __mul__(self, other): return NotImplemented class CNew(object): def __add__(self, other): return NotImplemented def __mul__(self, other): return NotImplemented a=CClassic() try: print a+2 except Exception, e: print e try: print a*2 except Exception, e: print e a=CNew() try: print a+2 except Exception, e: print e try: print a*2 except Exception, e: print e -------------------------------- Output following (correct) under Python 2.2: unsupported operand types for +: 'instance' and 'int' unsupported operand type(s) for *: 'instance' and 'int' unsupported operand types for +: 'CNew' and 'int' unsupported operand type(s) for *: 'CNew' and 'int' And following (wrong) under Python 2.3[.2]: unsupported operand type(s) for +: 'instance' and 'int' unsupported operand type(s) for *: 'instance' and 'int' unsupported operand type(s) for +: 'CNew' and 'int' NotImplemented ---------------------------------------------------------------------- >Comment By: Georg Brandl (gbrandl) Date: 2006-02-20 19:53 Message: Logged In: YES user_id=849994 This now seems to be fixed in 2.5 HEAD and 2.4 branch. Cheers! ---------------------------------------------------------------------- Comment By: Georg Brandl (birkenfeld) Date: 2005-10-01 13:38 Message: Logged In: YES user_id=1188172 I could reproduce with all my Pythons. I looked around a bit but couldn't find any cause of this. Michael, do you have more luck? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=847024&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com