[Python-Dev] Re: Re: lists v. tuples (original) (raw)
Guido van Rossum guido@python.org
Tue, 15 Apr 2003 19:49:50 -0400
- Previous message: [Python-Dev] Re: Re: lists v. tuples
- Next message: [Python-Dev] Re: Re: lists v. tuples
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido> And then we should also change list.sort(), as Tim points Guido> out. Maybe we can start introducing this earlier by using Guido> keyword arguments:
Guido> list.sort(lt=function) sorts using a < implementation_ _Guido> list.sort(cmp=function) sorts using a cmp implementation
[Andrew Koenig]
The keyword argument might not be necessary: It is always possible for a function such as sort to figure out whether a comparison function is 2-way or 3-way (assuming it matters) by doing only one extra comparison.
That's cute, but a bit too magical for my taste... It's not immediately obvious how this would be done (I know how, but it would require a lot of explaining). Plus, -1 is a perfectly valid truth value.
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] Re: Re: lists v. tuples
- Next message: [Python-Dev] Re: Re: lists v. tuples
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]