On 4/1/2011 3:45 AM, Paul Rubin wrote:
What happens then is you define a new interface.
Like key= versus cmp=
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.
If cmp had been left (or were reinstated) but its implementation changed
internally to use cmp_to_key to make it a wrapper for key, you would be
happy? 2to3 could probably gain a fixer to change
.sort(cmp=f) # to
import functools import cmp_to_key
.sort(key=functools.cmp_to_key(f))
I know some would not like this because interface change is not their
real concern.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list