Direct conversion from float to Decimal was implemented in python-2.7, both in Decimal\'s constructor and with the Decimal.from_float() classmethod.
Python-2.6 instead t
Your workaround is not the RightWayToDoIt(tm) because it loses information. The lossless way to convert is shown in the recipe for float_to_decimal()
shown in the Decimal FAQ.
The reason we didn't include Decimal.from_float in Python 2.6 is because we were being conservative about introducing unintentional interactions between binary floats and decimal floats. By Python 2.7, this was all worked out and you can just write Decimal(f)
where f is a binary float.
Other than the small nuisance in 2.6, I hope you're enjoying the Decimal module