Steve Howell wrote: > I think Gabriel was making the point that the *input* > to sorted() cannot be a generator, even thought > sorted() itself could in theory be a generator with > the right underlying implementation (e.g. heapsort).
Actually, the input to sorted() can be any iterable - sorted puts all the elements into a new list, sorts the new list, then returns the new (sorted) list. This means you can't return any items until you've exhausted the input iterable - which is what Gabriel was really getting at. Because of the documented semantics, it also must return the entire list. Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list