Guido rethinking removal of cmp from sort method

Terry Reedy tjreedy at udel.edu
Sun Apr 3 04:14:07 CEST 2011


On 4/2/2011 4:29 AM, harrismh777 wrote:

I am responding to both this and a previous post of yours.

Python is not a thing, but an abstraction of multiple parts. It is a 
name, a trademark of the Python Software Foundation. It is a Platonic 
ideal in the mind of Guido and others. It is a series* of versions 
intended to approach that ideal. That goal requires pruning as well as 
additions.

* with three subseries: 0.9 to 2.1, 2.2 to 2.7, 3.0 to 3.x

I call it object-based because in the plain English meaning of the 
words, that is what it is and has been from the start. It is a language 
for manipulating information objects that have identity, value, and 
(type, type or class, and class, respectively, in the three subseries). 
Python is object-based as opposed to memory-block-based, like C and 
other language. Understanding the difference is important for 
understanding or using Python.

[I do not care if before or, more likely, after Guido started Python, 
some other people defined Object-Based Language in a way that excludes 
Python. That does not give them ownership of 'object' and 'based'.]

I do not call Python object-oriented for two reasons.
(And I am not responsible for what anyone else says.)

1. Python started as purely type-based with no classes (in this respect, 
like C).  So if OOP means classes with inheritance, OOP does not apply 
to all of Python. It only became completely class-based in 3.0 when the 
obsolete Class and Instance *types* were omitted. They are still present 
in 2.7.

[The interfaces of these types were and are, of course, published. It is 
ironic that a removal that you philosophically oppose makes your desired 
designation of Python as object-oriented more plausible ;-).]

2. Calling it object-oriented somehow induces some people to fantasize 
that Python 'should' conform to a particular, non-Pythonic idea of OOP 
and that developers 'should' or 'have a responsibility' to conform to 
said person's ideas.

> In other words, does the PSF have a responsibility to maintain the
> L.sort(cmp= key= reverse=) interface for strictly *philosophical*
> principle based on established norms for *any* OOP language?

No.

I say this based on the philosophical principle that obligations are 
reciprocal. Each x.y version (and indeed, each x.y.z release) is a gift 
from the developers to the world, available to anyone who wants it. 
Gifts do not confer obligations on the giver, even if one thinks there 
might be some on the recipient.

In any case, cmp= is still present and has not been removed from any 
version in which it ever appeared. It was not retained in 3.0 because 
Guido thought that omitting it would move 3.0 closer to ideal Python. 
Python 3 was *always* intended to be something of a break from 2.x.

I believe I was one of the first to use the term, during the discussion 
(8 years ago or so) of changing the meaning of int/int (which is to say, 
the meaning of int.__div__(a,b)). I suggested that the first version in 
which the old meaning was dropped should be called 3.0 to *signify that 
there would be some breakage of 2.x code*.

-- 
Terry Jan Reedy




More information about the Python-list mailing list