From: Khalid Z. <kz...@gm...> - 2007-02-09 18:43:13
|
On 2/9/07, Andr=E9 Bouchet <and...@la...> wrote: > Hello, > > 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. jython's-future-is-python's-past-ly yours, - kz |