Guido rethinking removal of cmp from sort method
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sat Apr 2 07:27:33 EDT 2011
On Fri, 01 Apr 2011 19:29:59 -0700, Paul Rubin wrote:
> Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:
>> What I'm saying is this: cmp is already removed from sorting, and we
>> can't change the past. Regardless of whether this was a mistake or not,
>
> No it's not already removed, I just tried it (in Python 2.6, which is
> called "Python" for short) and it still works. It's not "removed" from
> Python until basically all Python users have migrated and "Python"
> essentially always means "Python 3".
You know full well that I'm talking about Python 3, not Python 2 or
Python 1. In Python 2, sort still takes a cmp argument, so what's the
problem?
> Until that happens, for Python 2
> users, Python 3 is just a fork of Python with some stuff added and some
> stuff broken, that might get its act together someday. I see in the
> subject of this thread, "Guido rethinking removal of cmp from sort
> method" which gives hope that one particular bit of breakage might get
> fixed.
You call it a breakage, but many others disagree. The point of this
thread was supposed to be to encourage people like you to come up with
good, reasoned, reasonable arguments for adding cmp, not to engage in FUD
about Python 3 being a "fork" of Python, or that there is never under any
circumstances any good reason for removing features.
I expected a certain amount of bitterness to come through, but if I had
realised just what a bunch of whining I was going to unleash, I would
have kept quiet.
[...]
> If "sorting" is in the stdlib like functools is, then the similarity
> makes sense and the suggestion isn't so bad. But you're proposing a 3rd
> party module, which is not the same thing at all.
In the face of opposition from senior developers who don't want cmp in
the language, and who will presumably oppose adding a "needless" module
to the standard library, you will need good solid evidence that this
functionality is wanted and needed, and not just a bunch of crappy
rationalizations like "I can't be bothered thinking up a key function",
which was actually suggested by someone in this thread. (Not in those
exact words, but that's the gist of it.) A good way to gather such
evidence is to make it a third party module first: if people want the
feature, they will install it, just like they install numpy or pyparsing
or any other wanted module that is not in the standard library.
And if not, in the absolute worst case, at least *you* can continue using
cmp in your own code.
I realise that this strategy will only imperfectly capture community
desire for cmp sorting, but do you have a better strategy?
You don't have to follow my suggestion. If you think you have a better
strategy for convincing the people doing the actual work to scratch
*your* itch instead of their own, then go right ahead and use it.
--
Steven
More information about the Python-list
mailing list