sorted (WAS: lambda)

Terry Reedy tjreedy at
Thu Jan 13 15:44:59 EST 2005

"Paul Rubin" <""@NOSPAM.invalid> wrote in message 
news:7xpt09xizb.fsf at
> Steven Bethard <steven.bethard at> writes:
>> Note that sorted is a builtin function, not a method of a list
>> object.
> Oh, same difference.  I thought it was a method because I'm not using
> 2.4 yet.  The result is the same, other than that having it as a
> function instead of a method is another inconsistency to remember.

No, not same difference.  A list method would only operate on lists, as is 
true of all list methods.  Being a function lets it work for any iterable, 
as is true of any function of iterable.  Big difference.  And consistent. 
One could argue though that it should have been put into itermethods module 
instead of builtins.

Terry J. Reedy

More information about the Python-list mailing list