cpython (3.2): Issue #12666: Added section about map changes.

http://hg.python.org/cpython/rev/0e2812b16f5f changeset: 73820:0e2812b16f5f branch: 3.2 user: Jason R. Coombs <jaraco@jaraco.com> date: Sat Dec 03 08:24:21 2011 -0500 summary: Issue #12666: Added section about map changes. files: Doc/howto/pyporting.rst | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -505,6 +505,18 @@ 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 ------------------------- -- Repository URL: http://hg.python.org/cpython
participants (1)
-
jason.coombs