Steven D'Aprano:

>For many iterables, the amount of memory is not excessive and the increase in 
>readability of len() is to be preferred over the side-effect of sum(1 for...).<

With side-effects do you mean the possibility of exhausting a lazy
iterable?

The readability difference is little, and it's way safer because it
works well enough with very long iterables too, so leniter(..) is
better than len(list(...)).

Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to