[Python-ideas] Changing Decimal.__pos__ and Decimal.__neg__ [Was: Re: Python Numbers as Human Concept Decimal System]

Stefan Krah stefan at bytereef.org
Mon Mar 10 14:58:24 CET 2014


Mark Dickinson <dickinsm at gmail.com> wrote:
> >>> -Decimal(0.0)  # negative sign mysteriously disappears.
> 
> Decimal('0')

Unless the rounding mode is ROUND_FLOOR. :(

>>> getcontext().rounding = ROUND_FLOOR
>>> -Decimal(0.0)
Decimal('-0')
>>>


Stefan Krah




More information about the Python-ideas mailing list