From: marcel l. <m_...@ya...> - 2007-02-28 14:49:31
|
Hi there,=0AI am wondering why does jython 2.2b1 fail to import pyparsing (= 1.4.5) module.=0A=0A>>> from __future__ import generators=0A>>> import pypa= rsing=0ATraceback (innermost last):=0A File "<console>", line 1, in ?=0A = File "/home/marcel/jython22b1/Lib/pyparsing.py", line 849=0A = yield tokens, preloc, nextLoc=0A ^=0A= SyntaxError: invalid syntax=0A=0Awhere a function like this works as expect= ed:=0A=0A>>> def generate_ints(N):=0A... for i in range(N):=0A... yield = i=0A...=0A>>>=0A>>> a=3D generate_ints(3)=0A>>> a.next()=0A0=0A>>> a.next()= =0A1=0A>>> a.next()=0A2=0A>>> a.next()=0ATraceback (innermost last):=0A Fi= le "<console>", line 1, in ?=0AStopIteration:=0A=0A=0AThanks for any and al= l help.=0AMarcel=0A=0A=0A=0A=0A=09=0A=09=0A=09=09=0A_______________________= ____________________________________ =0ANew Yahoo! Mail is the ultimate for= ce in competitive emailing. Find out more at the Yahoo! Mail Championships.= Plus: play games and win prizes. =0Ahttp://uk.rd.yahoo.com/evt=3D44106/*ht= tp://mail.yahoo.net/uk |
From: Charlie G. <cha...@gm...> - 2007-02-28 17:18:27
|
http://jython.org/bugs/1230674 explains that from __future__ doesn't work from the interpreter. We've got a patch for it, so it should fixed in 2.2 but it hasn't been applied yet. You should be able to use generators from a .py file without problems now. Charlie On 2/28/07, marcel liker <m_...@ya...> wrote: > Hi there, > I am wondering why does jython 2.2b1 fail to import pyparsing (1.4.5) module. > > >>> from __future__ import generators > >>> import pyparsing > Traceback (innermost last): > File "<console>", line 1, in ? > File "/home/marcel/jython22b1/Lib/pyparsing.py", line 849 > yield tokens, preloc, nextLoc > ^ > SyntaxError: invalid syntax > > where a function like this works as expected: > > >>> def generate_ints(N): > ... for i in range(N): > ... yield i > ... > >>> > >>> a= generate_ints(3) > >>> a.next() > 0 > >>> a.next() > 1 > >>> a.next() > 2 > >>> a.next() > Traceback (innermost last): > File "<console>", line 1, in ? > StopIteration: > > > Thanks for any and all help. > Marcel > > > > > > > > ___________________________________________________________ > New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. > http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |