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 wolma
Recipients gregory.p.smith, larry, ncoghlan, oscarbenjamin, steven.daprano, wolma
Date 2014-02-02.07:45:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1391327108.86.0.709092988753.issue20481@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks Nick for filing this!
I've been working on modifications to statistics._sum and statistics._coerce_types that together make the module's behaviour independent of the order of input types (by making the decision based on the set of input types) and, specifically, disallow certain combinations involving Decimal reliably.
Specifically, my modified version, like the original, returns the input type if there is only one; for mixed input types, differently than the original, it tries to return the most basic representative of the most narrow number type from the numbers tower (i.e., int if all input types are Integral, Fraction if all are Rational, float with all Real); Decimal is treated in the following way: if Decimal is the only input type or if the input types consist of only Decimal and Integral, Decimal is returned; my two versions of _coerce_types differ in that the first raises TypeError with any other combination involving Decimal, the second allows combinations of Decimal with float (returning float) and raises TypeError with all others.
I sent the first version to Steven D'Aprano and Oscar Benjamin for review.
History
Date User Action Args
2014-02-02 07:45:08wolmasetrecipients: + wolma, gregory.p.smith, ncoghlan, larry, steven.daprano, oscarbenjamin
2014-02-02 07:45:08wolmasetmessageid: <1391327108.86.0.709092988753.issue20481@psf.upfronthosting.co.za>
2014-02-02 07:45:08wolmalinkissue20481 messages
2014-02-02 07:45:08wolmacreate