Message233711
>>> import decimal
>>> x = 0
>>> y = float(x)
>>> z = decimal.Decimal(x)
>>> x == y == z == x
True
>>> x ** x
1
>>> y**y
1.0
>>> z**z
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/decimal.py", line 2216, in __pow__
return context._raise_error(InvalidOperation, '0 ** 0')
File "/usr/lib/python2.7/decimal.py", line 3872, in _raise_error
raise error(explanation)
decimal.InvalidOperation: 0 ** 0
This is PHP-like and confusing, and maybe not justified just by standards compliance. If it is justified by standards compliance, this deserves to be spelled out in big red letters in the documentation for the decimal module, along with any other inconsistencies. |
|
Date |
User |
Action |
Args |
2015-01-09 03:13:06 | Devin Jeanpierre | set | recipients:
+ Devin Jeanpierre |
2015-01-09 03:13:06 | Devin Jeanpierre | set | messageid: <1420773186.22.0.229704657455.issue23201@psf.upfronthosting.co.za> |
2015-01-09 03:13:06 | Devin Jeanpierre | link | issue23201 messages |
2015-01-09 03:13:05 | Devin Jeanpierre | create | |
|