You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defconsume(iterator, n):
"Advance the iterator n-steps ahead. If n is none, consume entirely."# Use functions that consume iterators at C speed.ifnisNone:
# feed the entire iterator into a zero-length dequecollections.deque(iterator, maxlen=0)
else:
# advance to the empty slice starting at position nnext(islice(iterator, n, n), None)
iterator should be replaced with iterable. This function accepts strings for example, which are not iterators.
On Mon, Jul 13, 2015 at 01:37:26AM +0000, Neil Girdhar wrote:
New submission from Neil Girdhar:
In the description of the consume recipe:
[...]
iterator should be replaced with iterable. This function accepts strings for example, which are not iterators.
It *accepts* strings, but it doesn't consume them. It runs through the
string, but the string still exists and you can iterate over it again
and again and again.
The intent of the recipe is to consume an *iterator* not arbitrary
iterables. I don't believe the recipe or its description needs to be
changed.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: