@@ -298,7 +298,7 @@ The Primitives
298
298
299
299
.. code-block :: pycon
300
300
301
- >>> items = zip(xrange (1000), xrange (1000)) # 1000 items
301
+ >>> items = zip(range (1000), range (1000)) # 1000 items
302
302
>>> add.chunks(items, 10)
303
303
304
304
will split the list of items into chunks of 10, resulting in 100
@@ -372,7 +372,7 @@ Here's some examples:
372
372
.. code-block :: pycon
373
373
374
374
>>> 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))()
376
376
>>> res.get(timeout=1)
377
377
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
378
378
@@ -385,7 +385,7 @@ Here's some examples:
385
385
.. code-block :: pycon
386
386
387
387
>>> 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())()
389
389
>>> res.get()
390
390
90
391
391
@@ -434,7 +434,7 @@ Here's some examples:
434
434
435
435
.. code-block :: pycon
436
436
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())
438
438
>>> res = c3()
439
439
>>> res.get()
440
440
90
@@ -459,7 +459,7 @@ Here's some examples:
459
459
460
460
.. code-block :: pycon
461
461
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)))()
463
463
>>> res.get()
464
464
<GroupResult: de44df8c-821d-4c84-9a6a-44769c738f98 [
465
465
bc01831b-9486-4e51-b046-480d7c9b78de,
@@ -683,7 +683,7 @@ Group also supports iterators:
683
683
684
684
.. code-block :: pycon
685
685
686
- >>> group(add.s(i, i) for i in xrange (100))()
686
+ >>> group(add.s(i, i) for i in range (100))()
687
687
688
688
A group is a signature object, so it can be used in combination
689
689
with other signatures.
@@ -800,7 +800,7 @@ get the sum of the resulting numbers:
800
800
>>> from tasks import add, tsum
801
801
802
802
>>> chord(add.s(i, i)
803
- ... for i in xrange (100))(tsum.s()).get()
803
+ ... for i in range (100))(tsum.s()).get()
804
804
9900
805
805
806
806
@@ -809,7 +809,7 @@ synchronization makes this a lot slower than its Python counterpart:
809
809
810
810
.. code-block :: pycon
811
811
812
- >>> sum(i + i for i in xrange (100))
812
+ >>> sum(i + i for i in range (100))
813
813
814
814
The synchronization step is costly, so you should avoid using chords as much
815
815
as possible. Still, the chord is a powerful primitive to have in your toolbox
0 commit comments