6 ms·
Why Python is a great language for teaching introductory programming classes
- johnm 19y agoWow! It's frightening how little people learn from history. Scheme/Lisp is much better for that use now and has been for, oh, decades. [But, then again, that's coming from a guy at that little community college on the peninsula. :-)] It's truly sad to me that Berkeley and MIT seem to have dumped Scheme as the introductory language for the "job skills" approach of using less flexible but more popular languages.
- jdale27 19y agoWhen did Berkeley dump Scheme as the introductory language? http://inst.eecs.berkeley.edu/~cs61a/sp08/ http://inst.eecs.berkeley.edu/~cs61a/sp08/
- johnm 19y agoPhew! Well, at least somebody still has a clue! Thanks for the update.
- aneesh 19y agofwiw, Harvard still teaches Scheme in its introductory sequence.
- attack 19y agoBeing able to code fast one-offs to solve problems or automate tasks is one of the strongest reasons to get into programming in the first place. This is hugely useful in engineering for example, not just in minimum wage grunt jobs. Scheme/Lisp facilitate this VERY poorly. Python is maps far better to how problems are commonly presented, very rarely has gotchas that would make you drag out some advanced programming construct, and has batteries included at a level which scheme/lisp may NEVER catch up with:) All of the world is not calculus! Spend all your time playing in that area and you won't become a very well rounded or capable programmer/engineer.
- johnm 19y agoIndeed. That's why I'm totally an advocate for a requirement for a concurrent track that's all about installing/configuring/administration of computers/networks with an automation (i.e., shell scripting, tool development, etc.) focus.
- attack 19y agoIt seems that you're still implying that python is only good enough for lowly sysadmin tasks?
- johnm 19y agoWhere did you get that ridiculous notion? There's a serious problem with how people learning languages... their exposure to their first language has a strong tendency to color their thinking (read: biases) towards/against other languages for the rest of their careers. Another serious problem is that students end up with very distorted views of what "programming" is by getting only one narrow view of the how things work. Some curricula are over-focused on the abstract, "math" side of the field while others are stuck on the basic engineering side. There's not only a need for both but also the very hands-on administration/operations side precisely so that people get a much more well-rounded experience of the entire picture.
- jacobolus 19y agoMIT’s intro CS course (using python) doesn’t strike me as particularly “job skills” targeted. Care to explain?
- abless 19y agoAt my university they teach you ML as the first language. It's a pretty cold start, but I think it's worth it.
- newt0311 19y agoInteresting that many of the reasons listed for beginning programmers could actually apply to all programmers.
- etal 19y agoGood points. One that's not really mentioned is that beginning CS students often want to start learning a language that will make them employable, right away. (Or, their parents want them to.) I know professors get a lot of pressure to teach Java instead of, say, Scheme or ML. Python offers a way out of that, by leaving room in the language for illustrating different CS concepts clearly, but also dangling that carrot of employability -- see http://news.ycombinator.com/item?id=181676 http://news.ycombinator.com/item?id=181676.
- sah 19y agoI think this is one of the best points for Python as a teaching language. It's not just approachable, it's also practical. I think most of the positive points mentioned here also apply to Ruby.
- jrockway 19y agoRuby requires you to understand OO to understand the language. While every CS student eventually needs to understand OO, it's not something I would want to explain in the first lecture. For that reason, I agree with the article that Python (or Scheme) is a good starting language. You can start with nothing, and add concepts until you understand the whole language. You don't need to know programming before you can understand "hello world". (Amusingly, I don't really like Python or Scheme, but I do like Perl and CL. I'm not sure what that says about my personality, but I'm sure it's something :)
- tokipin 19y agohere's something related: http://okasaki.blogspot.com/2008/02/in-praise-of-mandatory-indentation-for.html http://okasaki.blogspot.com/2008/02/in-praise-of-mandatory-i... (re: indentation-sensitive languages for teaching)
- sah 19y agoThere's a difference between "mandatory indentation" (good!) and what Python does. I wrote a rant on this subject: http://www.hackerdashery.com/2006/09/close-block-delimiter-symbols.html http://www.hackerdashery.com/2006/09/close-block-delimiter-s...
- tokipin 19y agothat's actually my opinion. i like the punctuation of closing symbols. my brain doesn't have to think about anything, it just sees "end" and that's that
- jacobolus 19y agoYour rant is rather silly, but if you'd like to know about the colon at the end of blocks: http://mail.python.org/pipermail/python-list/2000-December/062885.html http://mail.python.org/pipermail/python-list/2000-December/0... http://mail.python.org/pipermail/python-list/2000-December/063055.html http://mail.python.org/pipermail/python-list/2000-December/0... If you really want a close block delimiter, python is happy to oblige. Just spell it `#end`. ;-)
- ComputerGuru 19y agoWow! I had to re-read the second point several times before I could get it through my head: "Compile-time type errors annoy students to no end. It's better to at least let their program run and do SOMETHING rather than fail to compile and do NOTHING." This is non-sense. It's encouraging bad coding practice, and it's the reason why languages like ColdFusion, JavaScript, etc. gave real developers so much trouble: amateurs write code that "runs" but is wholly broken. I agree that Python is a great beginner (and pro) language, but not for this reason!!
- attack 19y agoThis may not fit your way of looking at this problem but please, read on. One of the most fun things about python, or any terse loose language, is that you can now write amazingly massive amounts of code without having to do exhaustive checking as you go. For example, in C, a non-expert will often end up having to write tons of tiny functions, recompiling, and testing _constantly_ in order to avoid the hell that is having written a large chunk of code containing one tiny error and not being able to find that error even after hours of debugging. Just the other day I reimplemented a rather large network protocol coded in C into ~1500 lines of python all at once. When it was done I decided, with some trepidation, to just run the whole thing and see what happens. It worked! Soon after, my test code did find one small type error in an obscure edge part of the code, but the good feeling from getting the immediate success didn't go away! So the bad practice is not having tests/asserts anyway -- regardless of whether your language has type checking. He is right that just running as much as possible can be much more encouraging and even FUN, for beginners especially.