Skip to content

Commit bc88ec5

Browse files
committed
Updated advice on six.moves.range/xrange; refs #23812.
1 parent 895dc88 commit bc88ec5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/topics/python3.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,10 @@ The ``long`` type no longer exists in Python 3. ``1L`` is a syntax error. Use
358358
``xrange``
359359
~~~~~~~~~~
360360

361-
Import ``six.moves.xrange`` wherever you use ``xrange``.
361+
If you use ``xrange`` on Python 2, import ``six.moves.range`` and use that
362+
instead. You can also import ``six.moves.xrange`` (it's equivalent to
363+
``six.moves.range``) but the first technique allows you to simply drop the
364+
import when dropping support for Python 2.
362365

363366
Moved modules
364367
~~~~~~~~~~~~~

0 commit comments

Comments
 (0)