sorted (WAS: lambda)

Delaney, Timothy C (Timothy) tdelaney at avaya.com
Thu Jan 13 17:46:29 EST 2005


Terry Reedy wrote:

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

Definitely not. iter*tools* is primarily for functions that take
iterators and *return* iterators i.e. don't use memory proportional to
the length of the iterator.

OK - so there are one or two exceptions, but their presense there has
been strongly justified (and nowhere else seems appropriate - for
example, itertools.tee).

Tim Delaney



More information about the Python-list mailing list