Re: Python generators (coroutines)

2008-04-23 Thread rocco . rossi
> Anyway, if you have a blocking operation, the only solution is to use > a thread or a separate process. > > Michele Simionato That's what I thought. It was in fact rather obvious, but I wanted to be sure that I hadn't overlooked some arcane possibility (ex. with the use of exceptions or somet

Re: Python generators (coroutines)

2008-04-23 Thread Michele Simionato
On Apr 23, 8:26 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Wed, 23 Apr 2008 10:53:03 -0700 (PDT), Michele Simionato: > You could have #2. It's a trivial variation of sending a value. For > example, > > http://twistedmatrix.com/trac/browser/trunk/twisted/internet/defer.py... > > Jean-

Re: Python generators (coroutines)

2008-04-23 Thread Jean-Paul Calderone
On Wed, 23 Apr 2008 10:53:03 -0700 (PDT), Michele Simionato <[EMAIL PROTECTED]> wrote: On Apr 23, 4:17 pm, [EMAIL PROTECTED] wrote: I would really like to know more about python 2.5's new generator characteristics that make them more powerful and analogous to coroutines. Is it possible for inst

Re: Python generators (coroutines)

2008-04-23 Thread Michele Simionato
On Apr 23, 4:17 pm, [EMAIL PROTECTED] wrote: > I would really like to know more about python 2.5's new generator > characteristics that make them more powerful and analogous to > coroutines. Is it possible for instance to employ them in situations > where I would normally use a thread with a blocki

Re: Python generators (coroutines)

2008-04-23 Thread Jean-Paul Calderone
On Wed, 23 Apr 2008 07:17:46 -0700 (PDT), [EMAIL PROTECTED] wrote: I would really like to know more about python 2.5's new generator characteristics that make them more powerful and analogous to coroutines. Is it possible for instance to employ them in situations where I would normally use a thre

Re: Python generators (coroutines)

2008-04-23 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: I would really like to know more about python 2.5's new generator characteristics that make them more powerful and analogous to coroutines. Is it possible for instance to employ them in situations where I would normally use a thread with a blocking I/O (or socket) opera

Python generators (coroutines)

2008-04-23 Thread rocco . rossi
I would really like to know more about python 2.5's new generator characteristics that make them more powerful and analogous to coroutines. Is it possible for instance to employ them in situations where I would normally use a thread with a blocking I/O (or socket) operation? If it is, could someone

Re: Python Generators

2008-03-18 Thread Marius Gedminas
On Mar 16, 9:24 am, Matt Nordhoff <[EMAIL PROTECTED]> wrote: > mpc wrote: > > def concatenate(sequences): > >     for seq in sequences: > >         for item in seq: > >             yield item > > You should check out itertools.chain(). It does this. You call it like > "chain(seq1, seq2, ...)" inste

Re: Python Generators

2008-03-16 Thread Matt Nordhoff
mpc wrote: > def concatenate(sequences): > for seq in sequences: > for item in seq: > yield item You should check out itertools.chain(). It does this. You call it like "chain(seq1, seq2, ...)" instead of "chain(sequences)" though, which may be a problem for you. The res

Re: Python Generators

2008-03-15 Thread Peter Otten
mpc wrote: > I am trying to write a while loop that will iterate over generators to > capture all the headers of FFCache directories. However, the > generators embedded within the argument of another generator do not > seem to re-initiate. the example below loops through and initiates the > genera

Re: Python Generators

2008-03-15 Thread sturlamolden
On 15 Mar, 21:35, mpc <[EMAIL PROTECTED]> wrote: > generator embedded in the argument only once. Can anyone explain while > the generator will not re-initiate, and suggest a simple fix? I am not sure what you are trying to do, but it seems a bit confused. >>> def concat(seq): for s in

Python Generators

2008-03-15 Thread mpc
HI all, I am trying to write a while loop that will iterate over generators to capture all the headers of FFCache directories. However, the generators embedded within the argument of another generator do not seem to re-initiate. the example below loops through and initiates the generator embedded i

Re: BBC R&D White Paper on Kamaelia Published (Essentially a framework using communicating python generators)

2005-06-13 Thread pmaupin
Yes, the question was about the lack of full coroutine support in Python, and whether in practice that was a problem or not. It's interesting that you think it may actually be a strength -- I'll have to mull that over. Thanks! Pat -- http://mail.python.org/mailman/listinfo/python-list

Re: BBC R&D White Paper on Kamaelia Published (Essentially a framework using communicating python generators)

2005-06-13 Thread Michael Sparks
enjoyed the paper. I'm pleased to hear that and I hope the ideas are useful at some point in time! (directly or indirectly :) > I don't have time to play with the code right now, but it sounds like fun. > I do have one question -- in practice, how difficult have you found it

Re: BBC R&D White Paper on Kamaelia Published (Essentially a framework using communicating python generators)

2005-06-12 Thread pmaupin
.co.uk/rd/pubs/whp/whp113.shtml I enjoyed the paper. I don't have time to play with the code right now, but it sounds like fun. I do have one question -- in practice, how difficult have you found it that Python generators don't maintain separate stacks? Regards, Pat -- http://mail.python.org/mailman/listinfo/python-list

BBC R&D White Paper on Kamaelia Published (Essentially a framework using communicating python generators)

2005-06-11 Thread Michael Sparks
13.shtml Essentially it provides a means of a) communicating to python generators b) linking these communications between generators (the result is calling these components), c) building interesting systems using it. (Next release will include some interesting things like a shell, introspection