A version gotcha. This is OK on 2.7 but errors on 2.6:

>>> from decimal import *
>>> Decimal(1.0)
Decimal('1')

>>> from decimal import *
>>> Decimal(1.0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/decimal.py", line 649, in __new__
    "First convert the float to a string")
TypeError: Cannot convert float to Decimal.  First convert the float to a 
string
>>> Decimal('1.0')
Decimal('1.0')


Reply via email to