Re: Request for elucidation: enhanced generators

2006-09-21 Thread Michele Simionato
Ben Sizer wrote: > But do you have an example of such a use case? Here is a 69 lines implementation of the idea of applying extended generators to manage Web forms (obviously this is only a proof of concept and it contains many mistakes, but you have something to get started). Notice that I am not

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Michele Simionato
Duncan Booth wrote: > One example which is commonly given is to implement a web application using > continuations. So in Python terms a session is handled by a generator which > yields a form to be sent back to the user and the user's response is sent > in to the request using the generator's send

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Ant
Ben Sizer wrote: ... > But do you have an example of such a use case? That's what I'm missing > here. I've been looking at this myself, trying to understand the point of coroutines. I believe that they boil down to generators which are able to take in data as well as provide it. A simple way of l

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Duncan Booth
"Ben Sizer" <[EMAIL PROTECTED]> wrote: >> If you have no use case for this you are, as always, perfectly free to >> ignore it, as the majority of Python users may well choose to do. Your >> existing generators should continue to work. > > But do you have an example of such a use case? That's what

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Fredrik Lundh
Ben Sizer wrote: > But do you have an example of such a use case? here's what I think is the first published example that uses "yield" for co-routine-like behaviour: http://effbot.org/zone/asyncore-generators.htm that snippet uses a generator to implement a simple network protocol. the g

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Ben Sizer
Steve Holden wrote: > Ben Sizer wrote: > > A simple question - can anybody give a short example of how these work > > and what they are good for? I've read PEP 342 and the associated bit in > > the What's New section and it's still all Greek to me. The latter seems > > to focus on how to do it, rat

Re: Request for elucidation: enhanced generators

2006-09-20 Thread Steve Holden
Ben Sizer wrote: > A simple question - can anybody give a short example of how these work > and what they are good for? I've read PEP 342 and the associated bit in > the What's New section and it's still all Greek to me. The latter seems > to focus on how to do it, rather than why you'd do it, so i

Request for elucidation: enhanced generators

2006-09-20 Thread Ben Sizer
A simple question - can anybody give a short example of how these work and what they are good for? I've read PEP 342 and the associated bit in the What's New section and it's still all Greek to me. The latter seems to focus on how to do it, rather than why you'd do it, so it doesn't aid the underst