[py-dev] Re: my first post to the list

Michele Simionato michele.simionato at gmail.com
Wed Apr 27 10:55:11 CEST 2005


On 4/26/05, Michele Simionato <michele.simionato at gmail.com> wrote:
> As an exercise, I was trying to implement generators using
> greenlets (I know there is an example on site, but I wanted
> to do it on my own) and I am a bit confused.

For the record, I have solved the confusion on my own. I misunderstood
what the parent greenlet is. I had the wrong idea that the parent greenlet
was the calling greenlet, whereas it is just the greenlet where the child 
greenlet is *defined*, not called. So my example works just by setting the 
right parent by hand: gen123.parent = main 
I see that the same trick is used in test_generators.py.
Still thinking to practical applications of the idea, but I believe
I understand the basics now.

           Michele


More information about the py-dev mailing list