#1022 defect closed fixed (fixed)
Explain Deferred for users familiar with callbacks
Reported by: | hypatia | Owned by: | edsuom |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | core | Keywords: | documentation |
Cc: | Predictive | Branch: | |
Author: |
Description
Attachments (1)
Change History (7)
comment:2 Changed 16 years ago by
Cc: | hypatia removed |
---|---|
Component: | → conch |
Owner: | changed from hypatia to edsuom |
Changed 16 years ago by
Attachment: | async.EAS.xhtml added |
---|
Updated version of "Asynchronous Programming with Twisted"
comment:3 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
I've attached a revised version of "Asynchronous Programming with Twisted" that expands the discussion of how a Deferred acts as a manager for callbacks. It includes an analogy of how a Deferred is used that is hopefully instructive to novices and experienced callbackers alike:
You can picture a function that returns a Deferred as acting like a librarian who responds to a patron's question ("Are these mushrooms poisonous?") with a handwritten note saying, "I don't have your answer off the top of my head, but let me know where I can call you with the answer when I have it." The caller to the function does the equivalent of the patron scribbling a phone number on the note by attaching a callback to the Deferred. An equivalent of a deferred chain is where the patron writes several numbers on the note, and the person answering the phone at the first number responds to the answer ("They're highly poisonous") with another answer ("It's too late to use another recipe, our dinner party is canceled") that the librarian relays to whomever answers the phone (some disappointed dinner guest, perhaps) at the second number. Note that the library patron has been able to wander off and forget all about this matter in the meantime; such is the beauty of asynchronous programming!
comment:4 Changed 16 years ago by
Component: | conch → core |
---|
comment:5 Changed 16 years ago by
Keywords: | review added |
---|
comment:6 Changed 6 years ago by
Keywords: | review removed |
---|
[mass edit] Removing review from closed tickets.