A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-March/098716.html below:

[Python-Dev] Mixing float and Decimal -- thread reboot

[Python-Dev] Mixing float and Decimal -- thread reboot [Python-Dev] Mixing float and Decimal -- thread rebootMark Dickinson dickinsm at gmail.com
Mon Mar 22 21:49:06 CET 2010
On Mon, Mar 22, 2010 at 8:44 PM, Guido van Rossum <guido at python.org> wrote:
> On Mon, Mar 22, 2010 at 12:33 PM, Raymond Hettinger
> <raymond.hettinger at gmail.com> wrote:
>> While we're on the topic, I think you should consider allowing the Fraction()
>> constructor to accept a decimal input.
>>
>> This corresponds to common schoolbook problems and simple client requests:
>>   "Express 3.5 as a fraction".
>>
>>    >>> Fraction(Decimal('3.5'))
>>   Fraction(7, 2)
>
> There is already a Fraction.from_decimal() class method.

So there is;  I'd failed to notice that!  So decimal -> fraction
conversion is implemented twice in the Fractions module---once in
__new__ and once in from_decimal.  Hmm.

Mark
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4