Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import decimal
>>> x = decimal.Decimal()
>>> decimal.Decimal.from_float(x)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python31\lib\decimal.py", line 687, in from_float
n, d = abs(f).as_integer_ratio()
AttributeError: 'Decimal' object has no attribute 'as_integer_ratio'
>>>
It seems from_float doesn't like it when a Decimal arrives. Personally, I think there should be an idiomatic way of saying "this number must be a Decimal" without an "isinstance".