Minus operator versus unary minus

Serhiy Storchaka storchaka at gmail.com
Sat May 30 04:45:32 EDT 2015


On 30.05.15 10:56, Peter Otten wrote:
> The following modification of the collections.Counter implementation
>
> https://hg.python.org/cpython/rev/fe4efc0032b5
>
> was just checked in with the line
>
> result[elem] = 0 - count
>
> Does this have an advantage over the obvious
>
> result[elem] = -count
>
> ?

>>> x = 0.0
>>> -x
-0.0 
 

>>> 0 - x
0.0 
 






More information about the Python-list mailing list