This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients abarry, eric.smith, ethan.furman, lemburg, mark.dickinson, pitrou, stutzbach
Date 2016-02-10.06:50:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1455087031.93.0.639840192039.issue26324@psf.upfronthosting.co.za>
In-reply-to
Content
For what it's worth, NumPy has exactly the same behaviour:

>>> np.array([-0.0, -0.0]).sum()
0.0

... which is a bit surprising, given that this is a much easier problem to fix when you know the type of everything in the array in advance.

The Decimal type has similar issues here, resulting from that implicit addition of 0:

>>> from decimal import Decimal, getcontext
>>> getcontext().prec = 5
>>> x = Decimal('3.1415926535893')
>>> sum([x])
Decimal('3.1416')

Fixing this would involve major changes to the way that sum works, or some horrible DWIM special-casing; I think it's best left as it is.
History
Date User Action Args
2016-02-10 06:50:32mark.dickinsonsetrecipients: + mark.dickinson, lemburg, pitrou, eric.smith, stutzbach, ethan.furman, abarry
2016-02-10 06:50:31mark.dickinsonsetmessageid: <1455087031.93.0.639840192039.issue26324@psf.upfronthosting.co.za>
2016-02-10 06:50:31mark.dickinsonlinkissue26324 messages
2016-02-10 06:50:31mark.dickinsoncreate