summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2011-12-03 13:24:21 (GMT)
committerJason R. Coombs <jaraco@jaraco.com>2011-12-03 13:24:21 (GMT)
commita90e364ea5c301e76e67e23e2162f4fa8066a6f3 (patch)
tree4c6d5e466e68b18c62a62d0cab7e75e2f710ac5a
parentdf9a5f5ecfbbdb5f2e791ee3b470e2a9db609286 (diff)
downloadcpython-a90e364ea5c301e76e67e23e2162f4fa8066a6f3.zip
cpython-a90e364ea5c301e76e67e23e2162f4fa8066a6f3.tar.gz
cpython-a90e364ea5c301e76e67e23e2162f4fa8066a6f3.tar.bz2
Issue #12666: Added section about map changes.
-rw-r--r--Doc/howto/pyporting.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst
index 309f3f7..df0d299 100644
--- a/Doc/howto/pyporting.rst
+++ b/Doc/howto/pyporting.rst
@@ -505,6 +505,18 @@ Otherwise it might very well be worth your time and effort to port your tests
to :mod:`unittest`.
+Update `map` for imbalanced input sequences
+'''''''''''''''''''''''''''''''''''''''''''
+
+With Python 2, `map` would pad input sequences of unequal length with
+`None` values, returning a sequence as long as the longest input sequence.
+
+With Python 3, if the input sequences to `map` are of unequal length, `map`
+will stop at the termination of the shortest of the sequences. For full
+compatibility with `map` from Python 2.x, also wrap the sequences in
+:func:`itertools.zip_longest`, e.g. ``map(func, *sequences)`` becomes
+``list(map(func, itertools.zip_longest(*sequences)))``.
+
Eliminate ``-3`` Warnings
-------------------------