Sorted Returns List and Reversed Returns Iterator
Fredrik Lundh
fredrik at pythonware.com
Fri Aug 22 03:14:11 EDT 2008
John Machin wrote:
> reversed came later; returning an iterator rather than a list provides
> more flexibility.
As in flexibility for the implementer, the day someone invents a sort
algorithm that doesn't have to look at all source items before it starts
producing output?
Because I fail to see how returning an object that supports forward
iteration only is more flexible for the *user* than returning an object
that supports random access, mutation, restartable iteration, *and*
forward iteration.
</F>
More information about the Python-list
mailing list