Re: [Twisted-Python] asynchronous python generator

2010-07-12 Thread Jean Daniel
> Maybe you've got bigger things in mind, but I don't know what all of > that buys you, at least from your example use case (client connects, > prints response from server, quits on 'stop'). What's wrong with keeping > it simple and handling responses in the Protocol? > > def lineReceived(self, lin

Re: [Twisted-Python] asynchronous python generator

2010-07-12 Thread Jean Daniel
> You didn't have to switch to a while loop here.  The simplest fix for > your for loop is this: > >   �...@inlinecallbacks >    def gotConnection(conn): >        for lineEvent in conn: >            line = yield lineEvent >            print line Yes, I did that too. I wanted the loop to be able to

Re: [Twisted-Python] asynchronous python generator

2010-07-12 Thread Lucas Taylor
On 7/12/10 11:43 AM, Jean Daniel wrote: > Hello, > > I wrote a small client protocol which connects to a notification > server. The client role is to connect, and then to print the > notification which comes from the server until the server says "stop" > > Does someone knows how to make the f

Re: [Twisted-Python] asynchronous python generator

2010-07-12 Thread exarkun
On 04:43 pm, jeandaniel.bro...@gmail.com wrote: >Hello, > >I wrote a small client protocol which connects to a notification >server. The client role is to connect, and then to print the >notification which comes from the server until the server says "stop" >(a netcat server do just fine, I use "nc

[Twisted-Python] asynchronous python generator

2010-07-12 Thread Jean Daniel
Hello, I wrote a small client protocol which connects to a notification server. The client role is to connect, and then to print the notification which comes from the server until the server says "stop" (a netcat server do just fine, I use "nc -C -l 6789"). I would like the API for this client pro