[Pyrex] __iter__ and yield

Mike Wyatt mikejohnwyatt at gmail.com
Mon Sep 20 05:17:36 CEST 2010


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

Thoughts on how to make this work?  I'm using Pyrex 0.9.9 with Python 2.6.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.copyleft.no/pipermail/pyrex/attachments/20100919/9694a722/attachment.html>


More information about the Pyrex mailing list