[Pyrex] nagging differences / implementing generators

Greg Ewing greg at cosc.canterbury.ac.nz
Fri May 7 07:14:10 CEST 2004


Bob Ippolito <bob at redivi.com>:

> > They would become C attributes of the behind-the-scenes extension type
> > being used to implement the generator-iterator.
> 
> Of course, but then you have to change the code generator to use 
> gen->locals->var instead of just var when compiling a generator.

Yes, but that's probably not as hard as it sounds. The code
generated for a variable access already depends on what kind of
scope the variable lives in (builtin, module, local, class).
It would just be a matter of adding a new kind of scope --
generator-local.

> Speaking of Stackless, it would be *awesome* to have a Pyrex mode that 
> spits out stackless-soft-switching compatible code (which wouldn't be 
> much different than generators), it's a pain in the butt to write the C 
> code by hand..

Yes, it would. Someone else can do it, though... :-)

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list