Opened 12 years ago

Closed 12 years ago

#2288 enhancement closed duplicate (duplicate)

deferredCoroutine using new generator features in Python 2.5

Reported by: mneeley Owned by:
Priority: normal Milestone: Core-2.5
Component: core Keywords: defer generator
Cc: Branch:


The new generator features in Python 2.5 (see allow us to get the effect of deferredGenerator in a much cleaner fashion, using regular old deferreds instead of waitForDeferred wrappers. This could be done with an extra wrapper around deferredGenerator (as described at, but we can save several function calls and layers of indirection with a more direct implementation, as given here. The modifications required to deferredGenerator are minimal, with most of the code just copied from deferredGenerator, but the clarity of the resulting syntax for writing deferred coroutines is substantial, as described in the blog post referenced above.

As far as code reuse, this is certainly not the best way to go about using the new generator features, but it seems to me to be more efficient than adding a wrapper layer around deferredGenerator, and I assume the old deferredGenerator/waitForDeferred code will be left in for backwards compatibility.

Attachments (1)

deferredCoroutine.patch (4.5 KB) - added by mneeley 12 years ago.

Download all attachments as: .zip

Change History (4)

Changed 12 years ago by mneeley

Attachment: deferredCoroutine.patch added

comment:1 Changed 12 years ago by Jean-Paul Calderone

See #2100, which seems to be for the same enhancement as this ticket, and has a branch containing an implementation (with unit tests). It's too bad it has sat around for so long with no interested party doing the necessary work to complete it.

comment:2 Changed 12 years ago by Glyph

Resolution: duplicate
Status: newclosed

This is definitely a duplicate of #2100.

I'll add a comment there so that this contributed patch isn't lost, but I doubt it will be applied (no tests, the existing patch has already been thoroughly discussed).

comment:3 Changed 8 years ago by <automation>

Owner: Glyph deleted
Note: See TracTickets for help on using tickets.