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.

Author dubnerm
Recipients
Date 2003-11-22.02:39:43
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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
History
Date User Action Args
2007-08-23 14:18:23adminlinkissue847024 messages
2007-08-23 14:18:23admincreate