[TriZPUG] Reminder: TriZPUG October 2011 Meeting: PLY

Karen Tracey kmtracey at gmail.com
Fri Oct 28 03:49:01 CEST 2011


I enjoyed the meeting, thanks!

On that example, that didn't work, apparently it's written for Python 3.
This line:

        s = input('calc > ')   # Use raw_input on Python 2

needs to be:

        s = raw_input('calc > ')   # Use raw_input on Python 2

(which the comment clearly says but none of us noticed). input() on Python 2
actually evaluates(!) the user's input and returns the result (
http://docs.python.org/library/functions.html#input). So entering 5+3 was
feeding the int 8 into the parser, which confused it since it since the
parser expects string input.

Karen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/trizpug/attachments/20111027/54576e16/attachment.html>


More information about the TriZPUG mailing list