I read this comment today:
When Python decides to add a "direction" parameter to sort() they do something like this:
3.2.7: sort(list)
3.2.8: sort(direction, list)
You can't upgrade from 3.2.7 to 3.2.8 without breaking things, because there is a new parameter. Here's how Peel (and all sane languages) add a "direction" parameter:
Perl 1.2.1: sort(thing)
Perl 1.2.2: sort (thing, direction=ascending)
In the new version, if you don't pass the argument to specify new optional behavior, you get the old behavior by default! That way things don't break.
It's not the first time I hear about this, but it seems really strange. Can somebody explain this decision once and for all? Surely it must have been motivated by some sort of reasoning, and not just "break things on purpose"?
I understand that things will (almost) inevitably break eventually or with major version changes, but this really seems like they intended it. Plus it was a minor version?
sortedfunction that receives an iterable, and alisthas asort. Neither of them have a "direction" argument. Where did you see this comment? can you link to a source? – Mureinik Jul 28 '21 at 07:43