New submission from Alexandru Moșoi alexan...@mosoi.ro:
Sometimes it's useful to get the number of elements yield by an iterator. For
example (if ilen is the name of the function):
def pi(n):
return ilen(for e in xrange(n) if isprime(e))
def count_pred(pred, iterator):
return
Benjamin Peterson benja...@python.org added the comment:
Please post to python-ideas first.
--
nosy: +benjamin.peterson
resolution: - rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9547
Raymond Hettinger rhettin...@users.sourceforge.net added the comment:
This has been rejected before. The core issue is that it is not a very useful
operation because it consumes the iterator.
Also, this isn't an operation worth optimizing because most iterators that do
something