I read that generators are allowed in jython 2.2. The following code
gives a syntax error in the line containing the yield statement.
def frange (a, b, step=1.0):
while a < b:
a += step
for x in frange(1.0, 3.5):
I work with java 1.6 and windows xp.
On 2/9/07, Andr=E9 Bouchet <andre.bouchet@...> wrote:
> I read that generators are allowed in jython 2.2. The following code
> gives a syntax error in the line containing the yield statement.
> def frange (a, b, step=3D1.0):
> while a < b:
> yield a
> a +=3D step
> for x in frange(1.0, 3.5):
> print x
> I work with java 1.6 and windows xp.
As with python 2.2, you need to add:
from __future__ import generators
to enable the feature.
From: Pekka Laukkanen <peke@ik...> - 2007-02-09 23:45:05
2007/2/9, Khalid Zuberi <kzuberi@...>:
'> As with python 2.2, you need to add:
> from __future__ import generators
> to enable the feature.
Just wondering what's the reason for not allowing this by default in
Jython 2.2? I don't think anyone is writing code targeted for Jython
2.2 and Python 2.2 these days. For example in my project, where we are
implementing a test automation framework to run both on Python and
Jython, we are keeping 2.3 the minumum but 2.4/2.5 recommended on
Python side. I've also understood that Jython 2.2 already contains a
lot of Python 2.3 features so enabling generators by default shouldn't
be that bad.
From: Frank Wierzbicki <fwierzbicki@gm...> - 2007-02-10 00:42:10
On 2/9/07, Pekka Laukkanen <peke@...> wrote:
> Just wondering what's the reason for not allowing this by default in
> Jython 2.2?
I'd say the big one is that jythonc does not support generators at
all, and I don't think jythonc is going to get any maintenance in its
current form. Other than that, it is really just a scope thing at
this point. We don't want to make any changes that aren't absolutely
critical so we can get to a real release.