This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ubershmekel
Recipients ezio.melotti, mark.dickinson, rhettinger, skrah, ubershmekel
Date 2010-07-01.21:52:44
SpamBayes Score 0.00028759602
Marked as misclassified No
Message-id <AANLkTimO-Vh_MUcIOgtPTtNPuiW4UfA6AWS5AHAylcuQ@mail.gmail.com>
In-reply-to <1278020501.43.0.374907284335.issue9136@psf.upfronthosting.co.za>
Content
Now that we're on the subject of "from_float", I just recalled this slight
issue:

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".

Should I open another ticket?
Files
File name Uploaded
unnamed ubershmekel, 2010-07-01.21:52:44
History
Date User Action Args
2010-07-01 21:52:46ubershmekelsetrecipients: + ubershmekel, rhettinger, mark.dickinson, ezio.melotti, skrah
2010-07-01 21:52:44ubershmekellinkissue9136 messages
2010-07-01 21:52:44ubershmekelcreate