Skip to content

Commit 90fe53f

Browse files
Wooden-Robotauvipy
authored andcommitted
chg: change xrange to range (celery#5926)
1 parent c76b1c2 commit 90fe53f

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/getting-started/next-steps.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ You can call a task using the :meth:`delay` method:
257257
.. code-block:: pycon
258258
259259
>>> from proj.tasks import add
260-
260+
261261
>>> add.delay(2, 2)
262262
263263
This method is actually a star-argument shortcut to another method called
@@ -532,14 +532,14 @@ as a group, and retrieve the return values in order.
532532
>>> from celery import group
533533
>>> from proj.tasks import add
534534
535-
>>> group(add.s(i, i) for i in xrange(10))().get()
535+
>>> group(add.s(i, i) for i in range(10))().get()
536536
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
537537
538538
- Partial group
539539

540540
.. code-block:: pycon
541541
542-
>>> g = group(add.s(i) for i in xrange(10))
542+
>>> g = group(add.s(i) for i in range(10))
543543
>>> g(10).get()
544544
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
545545
@@ -586,7 +586,7 @@ A chord is a group with a callback:
586586
>>> from celery import chord
587587
>>> from proj.tasks import add, xsum
588588
589-
>>> chord((add.s(i, i) for i in xrange(10)), xsum.s())().get()
589+
>>> chord((add.s(i, i) for i in range(10)), xsum.s())().get()
590590
90
591591
592592
@@ -595,7 +595,7 @@ to a chord:
595595

596596
.. code-block:: pycon
597597
598-
>>> (group(add.s(i, i) for i in xrange(10)) | xsum.s())().get()
598+
>>> (group(add.s(i, i) for i in range(10)) | xsum.s())().get()
599599
90
600600
601601

docs/userguide/canvas.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ The Primitives
298298

299299
.. code-block:: pycon
300300
301-
>>> items = zip(xrange(1000), xrange(1000)) # 1000 items
301+
>>> items = zip(range(1000), range(1000)) # 1000 items
302302
>>> add.chunks(items, 10)
303303
304304
will split the list of items into chunks of 10, resulting in 100
@@ -372,7 +372,7 @@ Here's some examples:
372372
.. code-block:: pycon
373373
374374
>>> from celery import group
375-
>>> res = group(add.s(i, i) for i in xrange(10))()
375+
>>> res = group(add.s(i, i) for i in range(10))()
376376
>>> res.get(timeout=1)
377377
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
378378
@@ -385,7 +385,7 @@ Here's some examples:
385385
.. code-block:: pycon
386386
387387
>>> from celery import chord
388-
>>> res = chord((add.s(i, i) for i in xrange(10)), xsum.s())()
388+
>>> res = chord((add.s(i, i) for i in range(10)), xsum.s())()
389389
>>> res.get()
390390
90
391391
@@ -434,7 +434,7 @@ Here's some examples:
434434

435435
.. code-block:: pycon
436436
437-
>>> c3 = (group(add.s(i, i) for i in xrange(10)) | xsum.s())
437+
>>> c3 = (group(add.s(i, i) for i in range(10)) | xsum.s())
438438
>>> res = c3()
439439
>>> res.get()
440440
90
@@ -459,7 +459,7 @@ Here's some examples:
459459

460460
.. code-block:: pycon
461461
462-
>>> res = (add.s(4, 4) | group(add.si(i, i) for i in xrange(10)))()
462+
>>> res = (add.s(4, 4) | group(add.si(i, i) for i in range(10)))()
463463
>>> res.get()
464464
<GroupResult: de44df8c-821d-4c84-9a6a-44769c738f98 [
465465
bc01831b-9486-4e51-b046-480d7c9b78de,
@@ -683,7 +683,7 @@ Group also supports iterators:
683683

684684
.. code-block:: pycon
685685
686-
>>> group(add.s(i, i) for i in xrange(100))()
686+
>>> group(add.s(i, i) for i in range(100))()
687687
688688
A group is a signature object, so it can be used in combination
689689
with other signatures.
@@ -800,7 +800,7 @@ get the sum of the resulting numbers:
800800
>>> from tasks import add, tsum
801801
802802
>>> chord(add.s(i, i)
803-
... for i in xrange(100))(tsum.s()).get()
803+
... for i in range(100))(tsum.s()).get()
804804
9900
805805
806806
@@ -809,7 +809,7 @@ synchronization makes this a lot slower than its Python counterpart:
809809

810810
.. code-block:: pycon
811811
812-
>>> sum(i + i for i in xrange(100))
812+
>>> sum(i + i for i in range(100))
813813
814814
The synchronization step is costly, so you should avoid using chords as much
815815
as possible. Still, the chord is a powerful primitive to have in your toolbox

0 commit comments

Comments
 (0)