of its columnsnot just simple numbers because this script converts input field values with the python eval built-in functionany python syntax will work in this table' fieldsas long as it can be parsed and evaluated within the scope of the onsum methodc:\pp \gui\tour\gridtype grid -data txt * - << % pow( , ** [ , ][ {' ': }[' ' len('abcd' abs(- eval(' + ' summing these fields runs the python code they containas seen in figure - this can be powerful featureimagine full-blown spreadsheet gridfor instance--field values could be python code "snippetsthat compute values on the flycall functions in modulesand even download current stock quotes over the internet with tools we'll meet in the next part of this book figure - python expressions in the data and table it' also potentially dangerous tool-- field might just contain an expression that erases your hard drive!if you're not sure what expressions may doeither don' use eval (convert with more limited built-in functions like int and float insteador make sure your python is running in process with restricted access permissions for system components you don' want to expose to the code you run of coursethis still is nowhere near true spreadsheet program there are fixed column sums and file loadsfor instancebut individual cells cannot contain formulas based debated showing thisbut since understanding danger is big part of avoiding it--if the python process had permission to delete filespassing the code string __import__('os'system('rm -rf *'to eval on unix would delete all files at and below the current directory by running shell command (and 'rmdir / / would have similar effect on windowsdon' do thisto see how this works in less devious and potentially useful waytype __import__('math'pi into one of the gui table' cells--on sumthe cell evaluates to pi ( passing "__import__('os'system('dir')to eval interactively proves the point safely as well all of this also applies to the exec built-in--eval runs expression strings and exec statementsbut expressions are statements (though not vice versaa typical user of most guis is unlikely to type this kind of code accidentallyof courseespecially if that user is always youbut be careful out theregrids