applied by calling eval when an error occurs inside an expressiona result operand of *erroris pushedwhich makes all remaining operators fail in eval too *erroressentially percolates to the top of the expression at the endit' the last operand and is displayed in the text entry field to alert you of the mistake entered keys" [result *error*(['+''*''(''+''*'][' '' '' '' '' '](['+''*''(''+'][' '' '' '' '](['+''*''('][' '' '' '](['+''*'][' ''*error*'](['+']['*error*'](['+']['*error*''*error*'][on evaltry tracing through these and other examples in the calculator' code to get feel for the stack-based evaluation that occurs once you understand the general shift/reduce (push/popmechanismexpression evaluation is straightforward pycalc source code example - contains the pycalc source module that puts these ideas to work in the context of gui it' single-file implementation (not counting utilities imported and reusedstudy the source for more detailsas usualthere' no substitute for interacting with the program on your own to get better feel for its functionality also see the opening comment' "to dolist for suggested areas for improvement like all software systemsthis calculator is prone to evolve over time (and in fact it haswith each new edition of this booksince it is written in pythonsuch future mutations will be easy to apply example - pp \lang\calculator\calculator py #!/usr/local/bin/python ""###############################################################################pycalc + python/tkinter calculator program and gui component evaluates expressions as they are enteredcatches keyboard keys for expression entry added integrated command-line popupsa recent calculations history display popupfonts and colors configurationhelp and about popupspreimported math/random constantsand more (pp eversion number retained)-port to run under python (only-drop 'lkeypress (the long type is now dead in earnest changes (pp )-use 'readonlyentry statenot 'disabled'else field is greyed out (fix for tkinter change)-avoid extended display precision for floats by using str()instead of ` `/repr((fix for python change)pycalca calculator program/object