This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incorrect Example in itertools.product description
Type: behavior Stage:
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: Matthew Ekstrand-Abueg, docs@python, rhettinger
Priority: normal Keywords:

Created on 2016-09-22 03:02 by Matthew Ekstrand-Abueg, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg277188 - (view) Author: Matthew Ekstrand-Abueg (Matthew Ekstrand-Abueg) Date: 2016-09-22 03:02
Documentation states:

    # product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
    # product(range(2), repeat=3) --> 000 001 010 011 100 101 110 

But:

>>> list(itertools.product('ABCD','xy'))
[('A', 'x'), ('A', 'y'), ('B', 'x'), ('B', 'y'), ('C', 'x'), ('C', 'y'), ('D', 'x'), ('D', 'y')]

https://docs.python.org/2/library/itertools.html#itertools.product
msg277193 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-09-22 06:02
The comments in the docs are necessarily terse and communicate the pattern of pairings.  It would not be an improvement to actually list out all the tuples.  

Sorry if this caused you any confusion, but I prefer to leave the comments as they are now.
History
Date User Action Args
2022-04-11 14:58:37adminsetgithub: 72431
2016-09-22 06:02:26rhettingersetstatus: open -> closed

nosy: + rhettinger
messages: + msg277193

assignee: docs@python -> rhettinger
resolution: wont fix
2016-09-22 03:02:03Matthew Ekstrand-Abuegcreate