On Wed, Dec 10, 2014 at 9:01 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > This also seems perfectly natural: > > def len(iterable): > return sum(1 for item in iterable) > > My observation is that seems strange to me that one standard sequence operation should be supported for arbitrary iterators and the other not. > > If the objection about `len(count())` is that the call would never return, I'll point out that `-42 in count()` suffers the same problem.
To further clarify what I'm saying, I don't think that len(iterable) should be supported. I'm just dismayed that "x in iterable" already is.
-- https://mail.python.org/mailman/listinfo/python-list