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 oscarbenjamin
Recipients gregory.p.smith, larry, ncoghlan, oscarbenjamin, steven.daprano, wolma
Date 2014-02-03.15:13:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20140203151344.GA4194@gmail.com>
In-reply-to <1391436857.76.0.349026313343.issue20481@psf.upfronthosting.co.za>
Content
I agree that supporting non-stdlib types is in some ways a separate issue from
how to manage coercion with mixed stdlib types. Can you provide a complete
patch (e.g. hg diff > coerce_types.patch).
http://docs.python.org/devguide/

There should probably also be tests added for situations where the current
implementation behaves undesirably. Something like these ones:
http://hg.python.org/cpython/file/a97ce3ecc96a/Lib/test/test_statistics.py#l1445

Note that when I said non-stdlib types can be handled by coercing to float I
didn't mean that the output should be coerced to float but rather the input
should be coerced to float because __float__ is the most consistent interface
available on third party numeric types.

Once the input numbers are converted to float statistics._sum can handle them
perfectly well. In this case I think the output should also be a float so that
it's clear that precision may have been lost. If the precision of float is not
what the user wants then the documentation can point them toward
Fraction/Decimal.
History
Date User Action Args
2014-02-03 15:13:49oscarbenjaminsetrecipients: + oscarbenjamin, gregory.p.smith, ncoghlan, larry, steven.daprano, wolma
2014-02-03 15:13:49oscarbenjaminlinkissue20481 messages
2014-02-03 15:13:49oscarbenjamincreate