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 Peter.Norvig
Recipients Peter.Norvig
Date 2016-05-02.20:59:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1462222751.06.0.733276334894.issue26913@psf.upfronthosting.co.za>
In-reply-to
Content
mean([True, True, True, False]) should be 0.75, but it returns 0.25.

The fix is to change _sum so that when the type is bool, the result should be coerced to int, not bool.

Why it is important for statistics.mean to work with bools:
It is natural to say something like
    mean(x > threshold for x in data)
and expect to get the percentage of items in data that are above threshold.
History
Date User Action Args
2016-05-02 20:59:11Peter.Norvigsetrecipients: + Peter.Norvig
2016-05-02 20:59:11Peter.Norvigsetmessageid: <1462222751.06.0.733276334894.issue26913@psf.upfronthosting.co.za>
2016-05-02 20:59:11Peter.Norviglinkissue26913 messages
2016-05-02 20:59:10Peter.Norvigcreate