sorted (WAS: lambda)

Fredrik Lundh fredrik at pythonware.com
Thu Jan 13 14:15:20 EST 2005


Paul Rubin wrote:

>> 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

nope.  sorted works on any kind of sequence, including forward-only
iterators.  sorted(open(filename)) works just fine, for example.

> other than that having it as a function instead of a method is another
> inconsistency to remember

I suspect that you don't really understand how sequences and iterators
work in Python...

</F> 






More information about the Python-list mailing list