Opened 11 years ago

Closed 11 years ago

#2287 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:
Author:

Description

The new generator features in Python 2.5 (see http://docs.python.org/whatsnew/pep-342.html) 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 http://codepoetics.com/poetix/?p=305), 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.

Change History (2)

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

Resolution: duplicate
Status: newclosed

Duplicate of #2288

comment:2 Changed 7 years ago by <automation>

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