Message98212
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/decimal.py", 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')
NotImplemented
(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:48 | mark.dickinson | set | recipients:
+ mark.dickinson, rhettinger, facundobatista, jjconti, skrah |
2010-01-24 10:52:48 | mark.dickinson | set | messageid: <1264330368.47.0.657805959395.issue7633@psf.upfronthosting.co.za> |
2010-01-24 10:52:47 | mark.dickinson | link | issue7633 messages |
2010-01-24 10:52:45 | mark.dickinson | create | |
|