Closed
Description
In style.rst, AKA "Coding style", the "Unpacking" section starts with quite a confusing sentence:
If you know the length of a list or tuple, you can assign names
to its elements with unpacking:for index, item in enumerate(some_list): # do something with index and item
The author is apparently referring to the tuple returned by enumerate()
built-in: we know its length is 2, so we can unpack it to 2 variables.
However, especially for reader new to Python, this might be confusing. The reader might assume that the list in question is some_list
, but then what does this have to do with length?
Metadata
Metadata
Assignees
Labels
No labels