Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line =...

125
Twisted & Monads

Transcript of Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line =...

Page 1: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Twisted & Monads

Page 2: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Twisted

Page 3: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Asynchronous networking framework in Python

Page 4: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Asynchronous

Page 5: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Non-blocking IO

Page 6: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Blocking IO

Page 7: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

line = remote.get_line()

Page 8: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Block a whole line is returned

Page 9: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

It's synchronous

Page 10: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

line = remote.get_line()

Page 11: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Want concurrency?

Page 12: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Use threads.

Page 13: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Not Twisted though

Page 14: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

HATE HATE HATE

Page 15: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

GIL

Page 16: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Correctness

Page 17: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Instead...

Page 18: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Cooperative multitasking

Page 19: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Non-blocking IO

Page 20: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Little chunks of IO…

Page 21: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

…that yield control…

Page 22: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

…to a central loop…

Page 23: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

…and fire events when done.

Page 24: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

The Reactor

Page 25: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

select();

Page 26: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

The code?

Page 27: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

remote.get_line( get_line_callback)

Page 28: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

uerrghh

Page 29: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

□ = remote.get_line()

Page 30: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

A placeholder

Page 31: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Promise

Page 32: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Future Value

Page 33: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Deferred

Page 34: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Mochikit

Page 35: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

What do you do with □?

Page 36: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Lotto ticket

Page 37: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Make plans

Page 38: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

□ → THIS

Page 39: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

THIS(x) :: <something>

Page 40: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

□.addCallback(THIS)

Page 41: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Not much better than passing a callback

Page 42: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Chaining

Page 43: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

□ → THIS → THAT

Page 44: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Synchronously...

Page 45: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

THAT(THIS(□))

Page 46: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

(THAT . THIS) □

Page 47: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Asynchronously...

Page 48: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

□.addCallback(THIS)□.addCallback(THAT)

Page 49: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

□.addCallback(THIS ).addCallback(THAT)

Page 50: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Explicitly encoding ordering of actions

Page 51: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Callbacks can return Deferreds

Page 52: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

def THIS(line): d = remote.get_line() return d.addCallback( lambda line2: (line1, line2))

Page 53: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

def THAT((line1, line2)): print line2 print line1

Page 54: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Important

Page 55: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Build asynchronous APIs

Page 56: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Interfaces are great

Page 57: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

No way out

Page 58: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Asynchronous builds on asynchronous

Page 59: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

succeed

Page 60: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Wraps a normal Python value in a Deferred

Page 61: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Added callbacks fire immediately

Page 62: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Haskell

Page 63: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Type Analysis!

Page 64: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

THIS :: String → Deferred

Page 65: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

addCallback :: Deferred → (String → Deferred) → Deferred

Page 66: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Hmm.

Page 67: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

addCallback :: D → (String → D) → D

Page 68: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

addCallback :: D → (a → D) → D

Page 69: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

addCallback :: D a → (a → D b) → D b

Page 70: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Hmmmm.

Page 71: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

(>>=) :: M a → (a → M b) → M b

Page 72: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

succeed :: a → D a

Page 73: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

return :: a → M a

Page 74: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Type signatures match

Page 75: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Doesn't make it a monad though

Page 76: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Monad Laws!

Page 77: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

(return x) >>= f ≡ f x

Page 78: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

m >>= return ≡ m

Page 79: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

The associative one

Page 80: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

(m >>= f) >>= g ≡

m >>= (\x -> f x >>= g)

Page 81: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Stand back!

Page 82: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

succeed(x).addCallback(f) ≡ f(x)

Page 83: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

d.addCallback(succeed) ≡ d

Page 84: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

d.addCallback(f).addCallback(g) ≡ d.addCallback(lambda x: f(x).addCallback(g))

Page 85: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Q. E. D.

Page 86: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Deferreds are monads.

Page 87: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Coincidence?

Page 88: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

I think not.

Page 89: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Deferreds abstract a sequence of operations

Page 90: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Monads abstract a sequence of operations

Page 91: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Deferreds are used when evaluation time is not guaranteed

Page 92: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Monads are used when evaluation time is not guaranteed

Page 93: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Both abstract “imperative” using functional language constructs

Page 94: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Differences

Page 95: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Deferreds mutate

Page 96: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

addErrback

Page 97: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Type flimsiness

Page 98: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

do {} notation

Page 99: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Twisted syntax is awful

Page 100: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Python not very malleable

Page 101: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Generator expressions

Page 102: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Introduced in Python 2.5

Page 103: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Before then...

Page 104: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

def f(): yield 1 yield 2

Page 105: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

>>> i = f()>>> i.next()

1>>> i.next()

2

Page 106: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

In Python 2.5 and later...

Page 107: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

def f(): y = yield 'banana' z = yield y

Page 108: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

>>> i = f()>>> i.send('orange')'banana'>>> i.send('apple')'orange'

Page 109: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Coroutines

Page 110: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

(but I don't understand that)

Page 111: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

inlineCallbacks

Page 112: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

@inlineCallbacksdef foo(): line1 = yield remote.get_line() line2 = yield remote.get_line() returnValue((line2, line1))

Page 113: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Hmmmmmm.

Page 114: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

do {} notation?

Page 115: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Specific to Deferreds

Page 116: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Conclusions

Page 117: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Haskell isn't that insane

Page 118: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

… or Twisted is bonkers

Page 119: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Open Questions

Page 120: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Generic do {} notation in Python?

Page 121: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

How do errors fit in?

Page 122: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

Immutable Deferreds?

Page 123: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

What can we steal from each other?

Page 124: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

?

Page 125: Twisted & Monadsframework in Python Asynchronous Non-blocking IO Blocking IO line = remote.get_line() Block a whole line is returned It's synchronous line = remote.get_line() Want

http://twistedmatrix.comhttp://code.mumak.net