[Python-ideas] checking for identity before comparing built-in objects

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Oct 11 06:07:33 CEST 2012


On Wed, Oct 10, 2012 at 9:20 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> Both -0.0 and 0.0 compare equal, but they can be distinguished (although
> doing so is tricky in Python).

Not really:

>>> math.copysign(1.0,-0.0)
-1.0
>>> math.copysign(1.0,0.0)
1.0



More information about the Python-ideas mailing list