Re: Minus operator versus unary minus

2015-05-30 Thread Dave Farrance
Peter Otten <__pete...@web.de> wrote: >so both +0.0 and -0.0 would be skipped anyway. Maybe the coder was simply aiming for visibility. The unary minus can be hard to spot in some circumstances. e.g.: I've sneaked a unary minus into this maths proof, which makes it horrible (although correct):

Re: Minus operator versus unary minus

2015-05-30 Thread Serhiy Storchaka
On 30.05.15 12:09, Peter Otten wrote: Serhiy Storchaka wrote: 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 a

Re: Minus operator versus unary minus

2015-05-30 Thread Peter Otten
Serhiy Storchaka wrote: > 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

Re: Minus operator versus unary minus

2015-05-30 Thread Serhiy Storchaka
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.

Re: Minus operator versus unary minus

2015-05-30 Thread Peter Otten
Steven D'Aprano wrote: > On Sat, 30 May 2015 05:56 pm, 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

Re: Minus operator versus unary minus

2015-05-30 Thread Steven D'Aprano
On Sat, 30 May 2015 05:56 pm, 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 > > re