-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
Description
In Chapter 18.1, the section on for
Loops says:
We use the
enumerate
method to adapt an iterator to produce a value and that value’s index in the iterator, placed into a tuple. The first call toenumerate
produces the tuple(0, 'a')
. When this value is matched to the pattern(index, value)
,index
will be0
andvalue
will be'a'
, printing the first line of the output.
It appears it should not say "The first call to enumerate
", but rather "The first call to next
", referring to the for loop implicitly calling next
on the iterator, as there is only the one call to enumerate
, and it produces not a tuple but a new iterator.