[Twisted-Python] Thoughts on Deferred
Itamar Shtull-Trauring
twisted at itamarst.org
Wed Mar 5 23:18:01 MST 2003
On Thu, 6 Mar 2003 06:02:23 +0000
"Clark C. Evans" <cce at clarkevans.com> wrote:
> 2. The error handling could use help. The cross-over behavior,
> while unique, doesn't provide any more value over a simple
> stack /w state flag (good/bad) attach to each callback.
Look again :)
In fac, the cross-over behaviour is designed to mimic Python's
try/except semantics in a callback oriented way. And exceptions are
*useful*.
try:
x = foo(2)
except FooError:
x = None
becomes:
d = foo(2)
def err(f):
f.trap(FooError)
return None
d.addErrback(err).addCallback(gotX)
More information about the Twisted-Python
mailing list