Guido rethinking removal of cmp from sort method

Terry Reedy tjreedy at udel.edu
Fri Apr 1 15:37:34 EDT 2011


On 4/1/2011 3:45 AM, Paul Rubin wrote:

> What happens then is you define a new interface.  In Microsoft-speak if
> the IWhatever interface needs an incompatible extension like new
> parameters, they introduce IWhatever2 which supports the new parameters.
> They change the implementation of IWhatever so it becomes a wrapper for
> IWhatever2 setting the new parameters to default values, to keep
> implementing the old behavior.

Now you have two versions, and eventually many more, to maintain and 
document. That takes resources we currently do not have.

Some problems in addition to the benefits of this approach:
1. The users of IWhatever will not gain the benefits of IWhatever2.
2. Upgrading to IWhatever2 requires a change of name as well as off 
parameters.
3. If only some users are upgraded, the IWhatever and IWhatever2 users 
may become incompatible even though they were before, thus breaking code 
without changing the old interface.

Example: Python2 added str2 (= unicode) on top of str. This had all the 
problems listed above. Since CPython uses str internally, in particular 
for identifiers, CPython users were stuck with the limitations of str. 
Rebinding str to mean str2 has many benefits, especially in the future, 
in addition to current costs.

-- 
Terry Jan Reedy




More information about the Python-list mailing list