
Visualize Python, Java, JavaScript, TypeScript, Ruby, C, and C++ Code Execution - kercker
http://pythontutor.com/
======
sumukh1
Here are some related links:

Demo of Python Tutor being used in a computer science textbook:
[http://www.composingprograms.com/pages/17-recursive-
function...](http://www.composingprograms.com/pages/17-recursive-
functions.html)

The textbook above is from the introductory computer science course at UC
Berkeley ([http://cs61a.org](http://cs61a.org))

Previous Discussion (~3 years ago):
[https://news.ycombinator.com/item?id=4601478](https://news.ycombinator.com/item?id=4601478)

If you are interested in the technical details of CPython, the author posted a
mini course on technical details about CPython here:
[http://pgbovine.net/cpython-internals.htm](http://pgbovine.net/cpython-
internals.htm)

1 hour podcast that describes the course:
[https://talkpython.fm/episodes/show/22/cpython-internals-
and...](https://talkpython.fm/episodes/show/22/cpython-internals-and-learning-
python-with-pythontutor.com)

~~~
fiatjaf
Do people really need all that text (in the textbook) to understand what a
recursive function is?

~~~
pgbovine
Yes, recursion is an extremely challenging topic for novices. Beware of the
_expert blind spot_ , in which experts such as yourself drastically
underestimate how difficult concepts are for novices to learn:

[http://teaching.colostate.edu/tips/tip.cfm?tipid=181](http://teaching.colostate.edu/tips/tip.cfm?tipid=181)

------
jaybosamiya
Phillip Guo, the creator of this software is also the author of a very nice
book called The Ph.D. Grind. I would definitely recommend reading it.
[http://www.pgbovine.net/PhD-memoir.htm](http://www.pgbovine.net/PhD-
memoir.htm)

------
m_mueller
Seeing the execution as a 2D representation reminds me a bit of Subtextual.
@pgbovine: I wonder whether you've seen this. Thinking of higher dimensional
representations of code has led me to think that our current way of
programming is still stuck in a world heavily influenced by terminals, even
given the most modern programming language. Alan Kay's work also seems to go
into a direction that tries to break out of this 1D world.

------
tkinom
Very nice!

It would be cool if there are examples can help visualize more advance concept
such dead lock, semaphore, mutex operations, GL/EGL APIs and shader
programming.

~~~
manaskarekar
Here are some books that use this tool:

[http://runestoneinteractive.org/library.html](http://runestoneinteractive.org/library.html)

\- How to Think Like a Computer Scientist: Interactive Edition

\- CS for All

\- Problem Solving with Algorithms and Data Structures Using Python

\- Everyday Python

\- Java For Python Programmers

\- Java Review for the AP CS A Exam

\- Java Review

\- Programs, Information, and People

\- Course Reader - CS160

\- Fundamentals of Web Programming

\- CS Principles: Big Ideas in Programming

------
jastanton
Very cool, a quick JS example using Addy's memoize function:
[http://goo.gl/TUldBl](http://goo.gl/TUldBl)

I could see using this to help junior engineers visualize code flow before
showing them how to step through code in Chrome dev tools

~~~
foxylion
Your sample is a bit broken and it took me some time to find out what is
broken. The memoized function is not actually returning anthing, so caching is
not possible. Also it has a side effect (console.log), so the second call
won't log. A better sample would be a method with a complicated, expensive
calculation.

Fixed version: [http://goo.gl/fAyqcV](http://goo.gl/fAyqcV)

------
vram22
PythonTutor is a good site.

I had come across a few other similar ones earlier. codingbat.com is one:

[http://jugad2.blogspot.in/2013/02/codingbat-progress-
graphs-...](http://jugad2.blogspot.in/2013/02/codingbat-progress-graphs-and-
michael.html)

The Michael Jordan quote mentioned in that post is a good and inspiring one :)

I recommend those sites to programming beginners who sometimes ask me for
resources about Python - but only to start and/or as a supplement. Nothing can
make up for getting the full experience of using Python (or any language) in a
desktop computer environment, command line, tools, etc.

------
vvanders
Very cool.

Now if only it would show cache misses as a button you have to click 400 times
before you can continue.

------
0xCMP
Wow I needed this last week! I was tutoring and I wanted to get this point
across using IDLE! Gave up and used PyCharm (made things worse).

Gonna keep this bookmarked for later...

------
aceofskies05
This is really really cool. As a Java developer, this really helps me
understand the "magic" of Javascript a bit better.

~~~
dclowd9901
Same for me, as a Javascript developer. Who knew setTimeout was just
setInterval with the internal _repeat flag set to false? Actually, I probably
should have known that...

------
melicerte
Any chance to have other languages supported? I'm thinking about PHP here for
instance.

As I plan to write a blog that would involves PHP code, that could be a nice
interactive addition.

------
vmorgulis
It seems static. I expected something dynamic with a VM or emscripten.

BTW interesting work!

