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
Probably because the behavior of a direct conversion can be counterintuitive if you don't know a few implementation details about floats. As stated in the docs:
Note
Decimal.from_float(0.1)is not the same asDecimal('0.1'). Since0.1is not exactly representable in binary floating point, the value is stored as the nearest representable value which is0x1.999999999999ap-4. That equivalent value in decimal is0.1000000000000000055511151231257827021181583404541015625.
If you convert to a string, you can control the precision you want to use, so you can get an accurate conversion to Decimal.
The new method was introduced in Python 2.7 - that's why it isn't in 2.6. New features are not backported to older versions.