[Twisted-Python] Maximum recursion depth reached
Maarten ter Huurne
maarten at treewalker.org
Fri May 9 05:20:57 MDT 2008
On Friday 09 May 2008, Steve Freitas wrote:
> def start(items):
> dl = []
> for item in items:
> dl.append(some_deferred(item))
> if len(dl) > 4:
> break
> items = items[len(dl):]
> if dl:
> return defer.DeferredList(dl).addCallback(next_batch, items)
> reactor.stop()
>
> def next_batch(_, items):
> return start(items)
By returning the DeferredList from next_batch(), you are chaining Deferreds:
http://twistedmatrix.com/projects/core/documentation/howto/defer.html#auto11
If you remove the "return" from next_batch(), the problem disappears. If you
want to be able to register a callback when all items are processed, it's
probably better to create a dedicated Deferred for that instead of chaining
the DeferredLists.
Bye,
Maarten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: </pipermail/twisted-python/attachments/20080509/f64f6bb4/attachment.sig>
More information about the Twisted-Python
mailing list