__iter__ and yield
Mike Wyatt <[email protected]> Sun, 19 Sep 2010 22:17:36 -0500
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Message-ID | <[email protected]> |
--===============1928692127==
Content-Type: multipart/alternative; boundary=0015173fe45a9ea0e00490a85ad8
--0015173fe45a9ea0e00490a85ad8
Content-Type: text/plain; charset=ISO-8859-1
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.
--0015173fe45a9ea0e00490a85ad8
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
I want to write a simple iterator for my vector class, but this code isn=
9;t compiling:<br><br>=A0=A0=A0 def __iter__( cVector2 self ):<br>=A0=A0=A0=
=A0=A0=A0 yield self.x=A0=A0=A0=A0=A0 # line 247<br>=A0=A0=A0 =A0=A0=A0 yi=
eld self.y<br><br>I get this error:<br>
<br>pyrexc src/cVector2.pyx --> src/cVector2.c<br>C:\Development\MikeLib=
\src/cVector2.pyx:247:8: Syntax error in simple statement list<br><br>Thoug=
hts on how to make this work?=A0 I'm using Pyrex 0.9.9 with Python 2.6.=
<br>
--0015173fe45a9ea0e00490a85ad8--
--===============1928692127==
Content-Type: text/plain; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
_______________________________________________
Pyrex mailing list
[email protected]
http://lists.copyleft.no/mailman/listinfo/pyrex
--===============1928692127==--