7 ms·
Online Python Tutor
- deleted 15y ago[deleted]
- thefool 15y agoThis is awesome. Would be cool to see a version for a lower level language like C that would help people understand the stack and visualize pointer arithmetic.
- DanielRibeiro 15y agoIf you found this awesome, Bret Victor will blow your mind (the coding tool is the third example): http://vimeo.com/36579366 http://vimeo.com/36579366
- johncoltrane 15y agoThank you. This guy is unbelievable. He blows my mind every time he publishes something. I want his editor.
- DanielRibeiro 15y agoI've emailed him asking for it! Gregory Bell asked him on twitter as well: https://twitter.com/#!/worrydream/status/169497569855143937 https://twitter.com/#!/worrydream/status/169497569855143937 No response so far.
- johncoltrane 15y agoI don't think he will answer positively. It's only a demo and somehow I don't see him releasing an unfinished program. But I can imagine other people picking up his ideas. Actually there is someone in the Vimeo comment thread who has started a live canvas editor(1) inspired by one of the demos. Edit: (1)http://www.youtube.com/watch?v=TBUC-7D1LIc http://www.youtube.com/watch?v=TBUC-7D1LIc
- triples 15y agoAmazing! His ideas and creative intensity are so refreshing.
- fady 15y agogreat link! geez, this reminds me why i like to use web developer tools so much when i'm adjusting my CSS, HTML, and JS. honestly, a lot of my ideas come from real time editing. i love making small adjustments to my values and getting to see those take effect instantly.
- gnosis 15y agoWOW! This is simply amazing. I hope this guy makes millions off his work. For something this revolutionary, he deserves it.
- jello 15y agoMind blown. Not just from the coding tools or the other examples, but the combination of those with a simple and powerful personal philosophy. I can't believe the original link (submitted 5 days ago) has gotten so few views/points.
- pajju 15y agohave you come across any such real-time tools for Wireframing/Mockups? Thanks.
- beggi 15y agoReally, really cool.
- agumonkey 15y ago100% cpu usage on chrome 19.0.1042.0 canary 0% cpu usage on firefox 13.0a1 (2012-02-18) until foo/bar execution (100% cpu usage too) Like it anyway. Great job
- deleted 15y ago[deleted]
- ht_th 15y agoAlthough I like these kind of tools, I doubt that they're useful to learn basic programming as they need a lot of prior knowledge to be present to already understand the visualization. For example, what is a stack or heap to a novice programmer? What will the effect of this visualization be on their construction of an operational understanding of basic programming language concepts? And these constructs, will they be helpful, have no effect, or even be detrimental for developing understanding of more complex programming structures? On the other hand, in a more advanced course, say at university level, it might help to construct knowledge about how programming languages work internally and how this relates to their already existing understanding of basic programming constructs. So, as a teacher be sure to evaluate the effect of the educational tools you use. I know it is easy to use existing cool tools (and this one definitely belongs to that category), but what is its effect on your students' learning?
- samdk 15y agoHaving been a teaching assistant for intro programming classes targeted at non-CS majors, I disagree. You don't need to understand what a 'stack' or 'heap' is to understand what's going on and for this to be useful. And even if it's too complicated to be useful for people on their own, being able to use something like this as a teaching aid would be very helpful. The number of people who have trouble grasping even what most of us consider very basic concepts like iteration over a list is astonishing. Trying to explain something you find trivially easy to someone who doesn't understand it at all is an exercise in frustration for both people. I usually resorted to doing a manual step-through on a whiteboard or piece of paper, but this is much nicer. I would discourage people from using this constantly, just because I think having a step-through debugger handy constantly will prevent you from developing necessary debugging skills. (The concept of wrapping something in print statements is another thing I take for granted that's not obvious to some people.) But I still don't see how something like this could be anything but a net positive.
- ht_th 15y ago> But I still don't see how something like this could be anything but a net positive. The student will construct their own knowledge of programming by some learning process. This tool has an effect on that process, as has every tool. It could, for example, let some students construct an understanding of a variable that makes it harder to start learning about, say, memoization in dynamic programming. (This is just an conjectured example, mind) I don't say it will, and I do have to say that the visualization given is quite nice and sound. But because we, as experienced programmers, like a tool because it visualizes how we think about programming and program execution, that does not mean that this is transferable in a similar way to novice programmers. As a high school computer science teacher I have been growing more and more worried about so called anti-didactic inversion in programming education. Especially at lower levels of education. In programming education, we often use professional programming tools with professional programming languages and professional measures of programming quality. When students are learning to become professional programmers, this is a good idea. But is it as good an idea for teaching programming to those who do not want to become professional programmers. Or for those who are learning programming as a basic skill (like math, language, etc)?
- bp_ 15y agoThe tool is awesome, but I wouldn't rely too much on the instruction bounds. For example, the greatest sums exercise (http://people.csail.mit.edu/pgbovine/python/question.html?optimize-sum#mode=edit http://people.csail.mit.edu/pgbovine/python/question.html?op...) can be solved in six "steps" for all input lengths, while it's certainly no O(1) business. def maxPairSum(data): return sum(sorted(data)[-2:]) # one "step"
- tobiasSoftware 15y agoActually, both your solution and theirs are not O(1). Theirs is n^2, while yours is n lg n due to the use of a sort function. The best way to do this would simply be to find the largest element, ignore that element and find the largest element again, which is O(n).
- cmurphycode 15y agoI do believe the GP's message was that the tutor told him his solution took one "step", which is not equivalent to O(1), because sorted() takes O(nlgn). In other words, he was pointing out the limitations of the tutor program's analysis.
- nhamann 15y agoIndeed, but it won't even accept the following O(n) solution. I get "(stopped after 20 steps to prevent possible infinite loop)" when submitting this: def maxPairSum(lst): if lst[0] > lst[1]: top, top2 = lst[:2] else: top2, top = lst[:2] for i in range(2, len(lst)): if lst[i] > top: top, top2 = lst[i], top elif lst[i] > top2: top2 = lst[i] return top+top2
- bp_ 15y agoI'm perfectly aware, but can you take that approach and execute it in 6 "steps" for all data sizes? Since the whole point of the exercise is "optimizing" maxPairSum so that it runs in 20 "steps" or less, I guess this slower solution is still more "optimized" - which was my whole point, after all. :) (Please note 6 steps is the bare minimum - one for the function definition, one for preparing input, one for calling the function, one for calling the function, one for assigning function arguments, one for the actual function and one for returning from the function. You can't go shorter than this.)
- mckoss 15y agoWorks great on iPad -- well done!
- rainboiboi 15y agoyea! Surprisingly!
- ya3r 15y agoWhere was the aliasing?
- leke 15y agoWas it y = x perhaps?
- wilfra 15y agoIf you want to learn Python, MIT OCW Intro to Programming is probably the best resource there is: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/ http://ocw.mit.edu/courses/electrical-engineering-and-comput...
- salemh 15y agoI got through 20% of Learn Python the Hard Way, stopped for a number of months, and have now delved into a few of the linked lectures. Learn Python the Hard Way is already much more intuitive and simple to pick up (in a good way). http://learnpythonthehardway.org/ http://learnpythonthehardway.org/ However, I think the lectures are complementary. :D
- vng 15y agoThis should be insanely useful for someone new to Computer Science. I wish I had this during my undergrad career. Good job!!
- pgbovine 15y agowhoa what a pleasant surprise seeing my project on the HN front page this morning! just an FYI: this is a "demo-quality" project, not production-quality. it's probably not ready for HN-level traffic! please email me if you have more detailed suggestions or bug reports, thanks.
- lhnz 15y agoHave you seen this presentation by Bret Victor [0], as he touches on user experience in writing code? It seems like it might improve your product. :) [0] http://vimeo.com/36579366 http://vimeo.com/36579366
- bwarp 15y agoI'd love to see this in debugger form!
- indubitably 15y agounicode breaks it
- pgbovine 15y agothanks! that's a known bug in my todo list
- norvig 15y agoIt is great that Hacker News has caught up with this -- Philip has done a great job with the Python Tutor. Next step: user-definable layout for display of different data types.
- abecedarius 15y agoThere was a paper on that sort of thing: Korn & Appel, "Traversal-based visualization of data structures". (It's online but I can't get the link out of the search result easily.)
- paufernandez 15y agoThanks a lot! I wish I had something like this for basic C++, my students would love it!
- deleted 15y ago[deleted]
- morenoh149 15y agoI need 4 lines to do the mergesort correction. What's the way that is expected here? I would do, if i = len(left): result.append(right[j]) if j = len(right): result.append(left[i])
- morenoh149 15y agonevermind, sneaked a peek at the original code http://en.literateprograms.org/Merge_sort_(Python) http://en.literateprograms.org/Merge_sort_(Python)
- gahahaha 15y agoDoes anything like this exist for Javascript?
- ilovecomputers 15y agoAs someone who went through Intro to CS courses. I must say that including the object oriented paradigm of Java in an intro class really confused me for a good three years. It wasn't until I learned how data was organized and executed inside a computer that it all became clear to me what programming really consisted of. This tool is wonderful. It visualizes the inner workings of a computer very well and how it translates to code. I hope this teaching tool is used on students after they've learned some basic programming concepts and syntax.
- forbes 15y agoThis is a fantastic tool. I love it. On line #9 of the example program, the string "hello" is assigned to y. On line #12 another string "hello" is used. I don't know anything about the inner workings of Python, but I imagine that these strings would be stored on the heap and possibly 'interned' by the interpreter. Maybe this is being ignored for simplicity, or I am way off the mark.