Is there a better/simpler way to filter blank lines?

Ben Finney bignose+hates-spam at
Wed Nov 5 03:22:10 CET 2008

Steve Holden <steve at> writes:

> I think there'd be no advantage to a sort method on a generator,
> since theoretically the last item could be the first required in the
> sorted sequence

Worse, generators don't necessarily *have* a finite set of items, and
there's no way in general of telling whether any particular generator
will have a “last item” without trying to get all the items. So it
would be actively harmful to provide such a method on generators, IMO.

 \              “Whatever you do will be insignificant, but it is very |
  `\                        important that you do it.” —Mahatma Gandhi |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list