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 steven.daprano
Recipients jfine2358, josh.r, remi.lapeyre, rhettinger, steven.daprano, vstinner
Date 2019-01-14.13:08:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1547471300.44.0.269345521594.issue35698@roundup.psfhosted.org>
In-reply-to
Content
I agree that for numeric data, it isn't worth changing the behaviour of median to avoid the division in the case of two equal middle values.

Even if we did accept this feature request, it is not going to eliminate the change in type in all circumstances. median([1, 2]) will still return 1.5. And in practical terms, the conditions where this would apply are likely to be quite unusual for numeric data. (Ordinal data is likely to be a different story.)

One way or another, the caller has to expect that the median of an even number of ints may return a number which is a float. If the caller doesn't want that behaviour, they can use median_low or median_high, which never take the average and always return a value from the data set.
History
Date User Action Args
2019-01-14 13:08:21steven.dapranosetrecipients: + steven.daprano, rhettinger, vstinner, josh.r, remi.lapeyre, jfine2358
2019-01-14 13:08:20steven.dapranosetmessageid: <1547471300.44.0.269345521594.issue35698@roundup.psfhosted.org>
2019-01-14 13:08:20steven.dapranolinkissue35698 messages
2019-01-14 13:08:20steven.dapranocreate