bignose+hates-spam at benfinney.id.au
Fri Jan 19 02:10:54 CET 2007
bearophileHUGS at lycos.com writes:
> But sometimes you don't need the elements of a given iterator, you
> just need to know how many elements it has.
AFAIK, the iterator protocol doesn't allow for that.
Bear in mind, too, that there's no way to tell from outside that an
iterater even has a finite length; also, many finite-length iterators
have termination conditions that preclude knowing the number of
iterations until the termination condition actually happens.
\ "When a well-packaged web of lies has been sold to the masses |
`\ over generations, the truth will seem utterly preposterous and |
_o__) its speaker a raving lunatic." -- Dresden James |
More information about the Python-list