Skip to content

Commit 89f9bf6

Browse files
committed
[1.6.x] Updated advice on six.moves.range/xrange; refs #23812.
Backport of bc88ec5 from master
1 parent ec861bc commit 89f9bf6

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
@@ -359,7 +359,10 @@ The ``long`` type no longer exists in Python 3. ``1L`` is a syntax error. Use
359359
``xrange``
360360
~~~~~~~~~~
361361

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

364367
Moved modules
365368
~~~~~~~~~~~~~

0 commit comments

Comments
 (0)