[Python-Dev] map(None, ...) in tutorial
Neil Schemenauer
nas at debian.org
Thu Aug 14 14:58:35 EDT 2003
More information about the Python-Dev mailing list
Thu Aug 14 14:58:35 EDT 2003
- Previous message: [Python-Dev] filter(bool, ...)
- Next message: [Python-Dev] map(None, ...) in tutorial
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I've noticed this section in the tutorial:
[...], we see that map(None, list1, list2) is a convenient way of
turning a pair of lists into a list of pairs. For example:
>>> map(None, seq, map(square, seq))
[(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25), (6, 36), (7, 49)]
I think the example be changed to use zip() instead, ie:
>>> zip(seq, map(square, seq))
[(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25), (6, 36), (7, 49)]
Any objections?
Neil
- Previous message: [Python-Dev] filter(bool, ...)
- Next message: [Python-Dev] map(None, ...) in tutorial
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list