[Python-ideas] Sorted lists

Paul Moore p.f.moore at gmail.com
Mon Apr 8 05:45:11 EDT 2019


On Mon, 8 Apr 2019 at 10:34, Steven D'Aprano <steve at pearwood.info> wrote:
> The median (and soon, quantiles) API says:
>
>     I'm going to sort the list for you, whether you need it or
>     not, just in case you do.

Hmm, I didn't see that mentioned in the docs. It makes a difference to
my comment about behaviour change, I think.

> It could become:
>
>     I'm going to sort the list for you, if necessary. If you
>     lie about it already being sorted, you'll get garbage.

But regardless, this would be the same potential behaviour change I
mentioned. (In the actual docs, it should probably be explicit about
the sort order, as someone who passes a list sorted in the wrong way
might not *think* they were lying, just that they hadn't sorted the
list...

Still not convinced this is safe enough to be worth it ;-)

Paul


More information about the Python-ideas mailing list