[Python-Dev] Decimal <-> float comparisons in py3k.

Mark Dickinson dickinsm at gmail.com
Wed Mar 17 14:40:41 CET 2010


On Tue, Mar 16, 2010 at 10:32 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Wed, 17 Mar 2010 03:23:30 am Mark Dickinson wrote:
>> On Tue, Mar 16, 2010 at 4:11 PM, Mark Dickinson <dickinsm at gmail.com>
>> wrote: [...]
>>
>> >>>> Decimal.from_float(1.1) == 1.1
>> >
>> > False
>>
>> Whoops.  To clarify, this is the pre-patch behaviour;  post-patch,
>> this gives True.
>
> Whew! You had me worried there for a second. Just to clarify, you are
> proposing:
>
> Decimal.from_float(1.1) == 1.1
> Decimal.('1.1') != float('1.1')

Exactly, yes.

--
Mark


More information about the Python-Dev mailing list