Hacker News new | past | comments | ask | show | jobs | submit login
What did you use to teach yourself Python?
54 points by humanlever on Nov 27, 2008 | hide | past | favorite | 44 comments

Byte of Python: http://www.swaroopch.com/notes/Python

Dive into Python: http://diveintopython.org/

Both great and free books.

seconding Dive into Python.

(I'll have to check out the first one)

These are great. The Python tutorial is very readable.

You could use these side by side with any decent university course that you can find online. Here is a link to Caltech's introductory Python course, with exercises posted that ramp up in difficulty while surveying most of the Python basics. http://www.cs.caltech.edu/courses/cs11/material/python/index...

And here is MIT's intro course on Python as well. Theirs includes the solutions too. http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Compute...

I've recommended Cal's self-paced online study guides http://www-inst.eecs.berkeley.edu/~selfpace/cs9honline/ to good feedback for an introduction to python and programming in general, while myself mostly relying on the books by Alex Martelli (Python in a Nutshell and Python Cookbook)

Same for me. Sometimes I refer to http://effbot.org/pyref/

I used an older edition of O'Reilly's Learning Python and found it to be very accessible and well written -- I'm surprised it hasn't been mentioned before: http://oreilly.com/catalog/9781565924642/

O'Reilly's Programming Python is not bad, but it's not a great book, either for beginners or journeymen.

Python in a Nutshell is more suitable as reference book, although I suppose you could use it to learn Python. For a Python reference book, I found David Beazley's Python Essential Reference to be more informative and better organized: http://www.amazon.com/Python-Essential-Reference-Developers-...

As other people have mentioned, Guido's online tutorial is pretty good, and you don't really much else to start programming in Python: http://docs.python.org/tutorial/index.html

I'm always puzzled by people recommending Mark Pilgrim's Dive into Python. I don't find it a good choice for Python beginners.

Two things: lots of risk and the O'Reilly book, "Learning Python."

I work for a company and was running a research project in air traffic control worth ~$400K. I was the principal investigator. We were going to create a tool that would redesign the airspace boundaries managed by a controller or controller team. At the time, I programmed in C, Awk, and a little Perl. I'd used Python at the command line, but had never programmed in it. I knew however it was the language we needed. I committed to it, and my partner agreed to it. We both learned Python on our own and the project succeeded. It had to succeed. If it didn't, we were in lots of trouble. We had company VPs watching us.

The Learning Python book is superior to the Programming Python book. While both are written with the same author, the Learning book is far more readable.

My favorite ongoing resource today is the documentation that comes with Python. I have a copy of it installed on the Linux box at work, and on my Macs at home. It is hands-down the best quick reference for the language.

I used the python tutorial and library reference in addition to "Python in a Nutshell" ( http://oreilly.com/catalog/9780596001889/ )

With a healthy amount of coding, I've gotten very comfortable with python, although I still feel like I'm not quite utilizing it idiomatically. As such, I've been going through Programming Python ( http://oreilly.com/catalog/9780596009250/ ) - which is very well written, IMO - as well as reading a healthy amount of other people's source code, notably CherryPy ( http://cherrypy.org/ ), since I use it a lot.

If you're experienced with other languages, I'd suggest implementing something like a tetris clone as an exercise in learning the language. If you're only experienced with web-dev (as is often the case these days), I'd recommend implementing a few small web-apps with CherryPy - it's the most "pythonic" "web framework" I've seen so far.

Oh, and keeping an eye on the mailing lists ( http://mail.python.org/mailman/listinfo ), particularly python-list, python-ideas, python-dev, and python-3000, can be very enlightening.

I pretty much begin doing projects in it. Started with some basic web scrapers, then I built a site in Django. Yes, I was one of those bastards that was learning Python AND Django at the same time, but it worked out for me.

I read the Python tutorial, and I have Python in a nutshell which I find is a great way to look something up and get a pretty good, detailed explanation on it.

Also one of those "bastards."

What's the time-frame between initial learning of Python and starting of learning Django to qualify as "one of those bastards"?

'cause I might be "one of those bastards", but I'm not sure. =\

It was pretty well simultaneous for me.

I'll second the python challenge. Unlike Project Euler, this challenge required the participant to rely on finding and using some python libraries (for imaging, networking, compression, etc.) to solve the puzzles. So, not only are you researching the language to figure it out, but you're actively engaged in self-directed research to find out how to complete real tasks with python.

I've also read the "Dive Into Python" book, but that was equivalent to reading a book about an instrument without actually holding or playing one.

I just started trying to solve problems on http://projecteuler.net/ with it, and learned a ton about it.

I'm always in the middle of learning a new language or framework, and the general pattern is always the same:

Read a bunch, get a project idea, start hacking on it to practice "muscle memory", use reference documentation a lot, go back and re-read -- picking up lots of info you missed the first time, get back to hacking. Keep cycling.

Many moons ago, I distinctly remember reading the 'Programming Perl' book 7 times before I finally felt like I understood what I was doing.

Glancing at the standard Python modules is a great way to learn. They are generally high-quality and will reveal many hidden tricks within Python (this is where I learned generator expressions).

Also I like Googling for "python tricks" as there are many gems hidden just waiting to be discovered. Here are a few examples:




Thing with Python is that it combines a shallow learning curve with very quick payback. You can use it as a glorified shell script if you want, and very quickly get something useful done, then anything you learn will have an immediate application to your next project. That's how I got into it. Then you go back and realize, hey, this for loop would be better as a list comprehension, these functions would work better together if I put them in a class, and refine your code.

Also, there are some good google tech talk videos:


Python Design Patterns: http://www.youtube.com/watch?v=0vJJlVBVTFg

I bought Beginning Python from APress, read through it in a day or two, then just started hacking. From then on the only things I used were the official Python library reference and any existing code I happened to be hacking on. Occasionally I'd look up articles on the Web about something I wanted to learn more about (decorators, meta-classes, etc.)

The folks in #python are also very helpful.

Actually I used "the" tutorial at python.org. But simultaneously I dived into it by writing web apps (which I was learning as well). In fact I wanted to learn writing webapps (and man there is so much more left aaaaah) and it came down to a choice between ruby and python. I went for python. And no, I am not going into why I chose one over the other!

So I just learnt it by writing several simple apps (thanks to django) and subscribing to a whole bunch of blogs to learn tips and tricks incrementally over time.


Really fun and challenging projects from image and audio processing to network programming. Each level is a computing puzzle which you must solve to progress to the next level. Very helpful forum too, which you will be needing since you'd have no idea about the techniques (the relevant python libraries and such) involved at the start.

I had a job where (among other things) I was teaching Python (and the VPython package) to high schoolers. That made me comfortable with it. Combined with PyLab and a need to wean myself from matlab before graduation, I worked on a few homework projects for other science classes. And most recently, I've been doing project euler.

I was put onto a Python project at work so I started with the best quick reference I could find (wikipedia!) and then went from there.

Started at: http://en.wikipedia.org/wiki/Python_(programming_language) http://en.wikipedia.org/wiki/Python_syntax_and_semantics

Found most other details on here: http://www.python.org/dev/peps/ http://www.python.org/doc/

There's some good online tutorials to ease into some of the trickier details like metaclasses and descriptors.

I was already coding Ruby before this (and some LISP before that) so the whole dynamic language thing was familiar enough I could get away with mostly references. Your milage may vary :)

I used a now-out-of-print book by Aaron Watters: Internet Programming with Python. http://www.amazon.com/Internet-Programming-Python-Aaron-Watt...

Python totally changed my world.

Just start working on a project and figure things out as you go.

thinkpython.com - although its supposed to be an introduction to programing using python but it suited me really well, even though I was a C++ programmer for four years. You can skip the basic parts and run through some of the explanations which are for a new programmer but all in all a rapid start guide for python.

I'm using the freely available thinkpython.pdf from http://www.greenteapress.com/thinkpython/

here's my setup - http://ideamonk.blogspot.com/2008/11/playing-with-python.htm...

I just wrote a script to getch results of all my batchmates from the college result site... :) http://sites.google.com/site/ideamonks/Home/107result.txt

"How to think like a computer scientist" is a text for teaching you programming concepts using python as a framework.. From what I've seen of it, it's pretty good. http://www.greenteapress.com/thinkpython/thinkpython.html

If you know all the programming concepts well - then go with Dive Into Python

I actually learned it recently by writing a small app for the Google App Engine and referencing the python docs.

After that I started learning Django using the Django docs and http://www.djangobook.com/ and this kind of rounded out the python bits as I went along

Haven't actually made reference to an actual Python book yet

The activestate download "http://www.activestate.com/Products/activepython/index.mhtml" for windows came with a nice helpfile which bundled a couple of tutorials, dive into python, library reference and lots more. A good place to start.

A very good book is Core Python Programming by Wesley Chun. : http://www.amazon.com/Core-Python-Programming-2nd/dp/0132269... But it is not for total beginners.

The ipython shell (http://ipython.scipy.org/) was great to experiment and learn with, and it's a huge productivity boost every day. It's where I do most of my work. It would be very hard for anyone going back to the plain python shell after trying ipython.

If you're new to Python and play games like Counter-Strike: Source and Team Fortress 2, try out EventScripts to customize the game: http://python.eventscripts.com

Dive into Python: http://diveintopython.org/ And then I bought Python in a Nutshell, which covers a lot of things in more depth, with decent examples. Recommended.

David Beazley's Python Essential Reference.

you can do chapter 1 examples with the python basics in the interpreter and go from there. by far the easiest and best programming book I've ever come across.

All the basics in one remarkably short chapter.

of course, you'll have to have an understanding of concepts, like lists for instance. but it's so easy to play around in python you can figure those things out, and how they work on your own.

then use the python cookbook to hack up your own scripts. break them down to simple versions and you'll learn a lot when solving your own problems.


I read a ton of different things including everything mentioned thus far and found the online tutorial written by Guido to be the most beneficial.

Project Euler + Django

The Hazel Tree: http://thehazeltree.org/

there's a new book out called, 'expert python programming'... check it out if you're beyond 'Learning python'

Dive into Python here.

Idiomatic Python: http://python.net/~goodger/projects/pycon/2007/idiomatic/han...

Probably the best complement to the aforementioned tutorials. Dive into Python is good but i hate the examples he makes.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact