Skip to content

Mistake in Chapter 18.1, under for loops #1994

@Zoybean

Description

@Zoybean

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 to enumerate produces the tuple (0, 'a'). When this value is matched to the pattern (index, value), index will be 0 and value 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions