On Dec 28, 7:28 am, Steven D'Aprano <st...@remove-this- cybersource.com.au> wrote: > Ah crap, I forgot that from_float() has been left out of the decimal API. > That's very annoying.
Agreed. It's maybe even annoying enough that a feature request at bugs.python.org might be honoured. (Hint, hint!) It's fairly easy to emulate in Python 2.6 and above, using the as_integer_ratio float method: >>> from decimal import Decimal >>> from math import pi >>> n, d = pi.as_integer_ratio() >>> Decimal(n)/d Decimal('3.141592653589793115997963469') Mark -- http://mail.python.org/mailman/listinfo/python-list