@@ -151,15 +151,17 @@ older).
151151``from __future__ import unicode_literals ``
152152'''''''''''''''''''''''''''''''''''''''''''
153153
154- If you choose not to use this future statement you should then mark all of your
154+ If you choose to use this future statement then all string literals in
155+ Python 2 will be assumed to be Unicode (as is already the case in Python 3).
156+ If you choose not to use this future statement then you should mark all of your
155157text strings with a ``u `` prefix and only support Python 3.3 or newer. But you
156158are **strongly ** advised to do one or the other (six _ provides a function in
157159case you don't want to use the future statement **and ** you want to support
158160Python 3.2 or older).
159161
160162
161- Bytes literals
162- ''''''''''''''
163+ Bytes/string literals
164+ '''''''''''''''''''''
163165
164166This is a **very ** important one. Prefix Python 2 strings that
165167are meant to contain bytes with a ``b `` prefix to very clearly delineate
@@ -504,12 +506,13 @@ your time and effort to port your tests to :mod:`unittest`.
504506Update ``map `` for imbalanced input sequences
505507'''''''''''''''''''''''''''''''''''''''''''''
506508
507- With Python 2, ``map `` would pad input sequences of unequal length with
508- `None ` values, returning a sequence as long as the longest input sequence.
509+ With Python 2, when ``map `` was given more than one input sequence it would pad
510+ the shorter sequences with `None ` values, returning a sequence as long as the
511+ longest input sequence.
509512
510513With Python 3, if the input sequences to ``map `` are of unequal length, ``map ``
511514will stop at the termination of the shortest of the sequences. For full
512- compatibility with ``map `` from Python 2.x, also wrap the sequences in
515+ compatibility with ``map `` from Python 2.x, wrap the sequence arguments in
513516:func: `itertools.zip_longest `, e.g. ``map(func, *sequences) `` becomes
514517``list(map(func, itertools.zip_longest(*sequences))) ``.
515518
@@ -518,9 +521,8 @@ Eliminate ``-3`` Warnings
518521
519522When you run your application's test suite, run it using the ``-3 `` flag passed
520523to Python. This will cause various warnings to be raised during execution about
521- things that 2to3 cannot handle automatically (e.g., modules that have been
522- removed). Try to eliminate those warnings to make your code even more portable
523- to Python 3.
524+ things that are semantic changes between Python 2 and 3. Try to eliminate those
525+ warnings to make your code even more portable to Python 3.
524526
525527
526528Alternative Approaches
0 commit comments