[Pyrex] __iter__ and yield
Stefan Behnel
stefan_ml at behnel.de
Thu Sep 30 17:27:42 CEST 2010
Mike Wyatt, 20.09.2010 05:17:
> I want to write a simple iterator for my vector class, but this code isn't
> compiling:
>
> def __iter__( cVector2 self ):
> yield self.x # line 247
> yield self.y
>
> I get this error:
>
> pyrexc src/cVector2.pyx --> src/cVector2.c
> C:\Development\MikeLib\src/cVector2.pyx:247:8: Syntax error in simple
> statement list
"yield" (i.e. generators and coroutines) is an unsupported feature in both
Pyrex and Cython. Cython will hopefully get them implemented in the near
future, although there's no time frame yet. There's a CEP, though:
http://wiki.cython.org/enhancements/generators
Stefan
More information about the Pyrex
mailing list