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 mark.dickinson
Recipients facundobatista, jjconti, mark.dickinson, rhettinger, skrah
Date 2010-01-24.10:52:45
SpamBayes Score 2.94372e-10
Marked as misclassified No
Message-id <>
Thanks for the latest patch!  It's looking good, but I have a few comments:

(1) It's not necessary to do an isinstance(a, Decimal) check before calling _convert_other, since _convert_other does that check anyway.  It doesn't really harm either, but for consistency with the way the Decimal methods themselves are written, I think the isinstance check should be left out.

(2) The error message that's produced when the Decimal operation returns NotImplemented is a bit strange:

>>> decimal.getcontext().add(2, 'bob')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dickinsm/python/svn/trunk/Lib/", line 3869, in add
    raise TypeError("Unable to convert %s to Decimal" % r)
TypeError: Unable to convert NotImplemented to Decimal

Presumably that '% r' should be '% b' instead.

(3) It looks like Context.power is missing a NotImplemented check:

>>> decimal.getcontext().power(2, 'bob')

(4) We should consider updating the documentation for the Context methods, though there's actually nothing there that would suggest that these operations wouldn't work for integers.
Date User Action Args
2010-01-24 10:52:48mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, facundobatista, jjconti, skrah
2010-01-24 10:52:48mark.dickinsonsetmessageid: <>
2010-01-24 10:52:47mark.dickinsonlinkissue7633 messages
2010-01-24 10:52:45mark.dickinsoncreate