eval and expressions

35 views
Skip to first unread message

zd

unread,
Aug 4, 2016, 10:09:20 AM8/4/16
to brython
Hello,

I have question is eval completely implemented as normal code run?  As recently I was trying simple code

a = eval('1 if 3 == 4 else 0')
print(a)

This normally works in when this is assigned to variable, but when it is in eval it seems to not work. This normally works in CPython 2.7 - 3.4 as I have tested. I have tested this in Editor on page 3.2.7 and also in my version 3.2.2 and seems to behave same. I do not use this kind of syntax too much, but got code where it was.

 module <string> line 1
  1 if 3 == 4 else 0
   ^
SyntaxError: eval() argument must be an expression
<completed in  39.00 ms>



Is there some reason for this? Anyway, thanks for best programming lang for web ;)

Regards,

zd

Kiko

unread,
Aug 4, 2016, 10:29:46 AM8/4/16
to bry...@googlegroups.com
Hi, it seems a bug in the parser.

Please, could you open an issue here: https://github.com/brython-dev/brython/issues

Thanks for the report.
 

Regards,

zd

--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+unsubscribe@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/3cda161c-3ddf-4da5-8246-c7137faf255c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pierre Quentel

unread,
Aug 5, 2016, 2:46:54 AM8/5/16
to brython
Yes, it was a bug in the parser. No need for an issue in the tracker for this time, I have fixed it in the latest commit.

Thanks
Reply all
Reply to author
Forward
0 new messages