Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91522
| From | Serhiy Storchaka <storchaka@gmail.com> |
|---|---|
| Subject | Re: Minus operator versus unary minus |
| Date | 2015-05-30 12:32 +0300 |
| References | <mkbqfn$9p0$1@ger.gmane.org> <mkbtbd$ksm$1@ger.gmane.org> <mkbuok$90v$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.219.1432978385.5151.python-list@python.org> (permalink) |
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 an advantage over the obvious >>> >>> result[elem] = -count >>> >>> ? >> >>>>> x = 0.0 >>>>> -x >> -0.0 >> >> >>>>> 0 - x >> 0.0 > > That's a subtle difference, but does it matter in the context of the patch? I don't know. Perhaps there is more meaningful difference for decimals. This code is not new (see https://hg.python.org/cpython/rev/e908ebc160f0).
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Minus operator versus unary minus Serhiy Storchaka <storchaka@gmail.com> - 2015-05-30 12:32 +0300
csiph-web