callback patterns and idioms in Python
callback patterns and idioms in Python
callback patterns and idioms in Python
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Callbacks <strong>and</strong> Errors<br />
are "errors" events like any others?<br />
or are they best s<strong>in</strong>gled-out?<br />
http://www.python.org/pycon/papers/deferex/<br />
Twisted Matrix's "Deferred" pattern: one<br />
Deferred object holds...<br />
N "cha<strong>in</strong>ed" <strong>callback</strong>s for "successes" +<br />
M "cha<strong>in</strong>ed" <strong>callback</strong>s for "errors"<br />
each <strong>callback</strong> is held WITH opt *a, **kw<br />
plus, argument for "event / error<br />
identification" (or, result of previous<br />
<strong>callback</strong> along the appropriate "cha<strong>in</strong>")<br />
16