On Sun, Mar 6, 2016 at 6:23 PM, Al Sweigart <a...@inventwithpython.com> wrote:
> How does it compare to Philip Guo's Python Tutor? > http://www.pythontutor.com/ I really like how this tool can trace > forwards and backwards through the program. > PythonTutor is indeed a fantastic tool! > > Also, less popular is a tool I wrote for visualizing how expressions get > evaluated. It's called ShowEval: http://inventwithpython.com/showeval/ > >From what I can see, showeval requires explicit pre-encoding of the result of each steps (whereas Python Tutor produces those automatically). One can essentially obtain similar results automatically (i.e. without pre-encoding) using Reeborg's World. (link to the new, development version http://reeborg.ca/reeborg.html?lang=en&mode=python) 1. Enter the following code in the editor (adapted from showeval) eggs = ['dogs', 'cats', 'moose'] a = ''.join(eggs) a = a.upper() a = a.join(eggs) 2. Click on the magnifier icon at the top right corner of the editor; this will open a "watch" variable window 3. Execute the program by clicking on the "play" icon under the header bar, at the top right 4. Watch the values of the variables change --- * You can click on the "step" button (immediately to the right of the "play" icon) to execute each statement one at a time. At the moment, one sometimes needs to click it multiple times to go to the next statement. * Alternatively, one can change the speed of the animation by inserting the following call think(time_in_ms) at the top of the program. * If one steps through the program one line at a time, it is possible to step backwards; click on "Additional options" at the top. This will bring a window with multiple additional buttons, including one which does a "reverse" step. * Instead of automatically adding new variables as they are created, one can add expressions to watch using add_watch() e.g. add_watch("a+a") for the example above. A "complete" example could be: think(1000) add_watch("a+a") eggs = ['dogs', 'cats', 'moose'] a = ''.join(eggs) a = a.upper() a = a.join(eggs) André Note: I gave the link to the development version, even though it is currentlynot quite as complete as the "old" one, http://reeborg.ca/world.html, since the latter will soon be obsolete). Note 2: for additional help on available functions, insert help(reeborg_en) as a statement in a Python program and execute it. >
_______________________________________________ Edu-sig mailing list Edu-sig@python.org https://mail.python.org/mailman/listinfo/edu-sig