What did you use to teach yourself Python?

54 points by humanlever ↗ HN

46 comments

[ 5.7 ms ] story [ 59.0 ms ] thread
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 would learn Python the same way as I learned any language. I had an idea which I HAD to build and I did it. Learning the language was almost secondary. Who learns a language from reading a book. I get about halfway through the table of contents and toss it. I use books as reference.
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'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.

Project Euler + Django
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.
Just start working on a project and figure things out as you go.
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.
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.
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 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.
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:

http://kogs-www.informatik.uni-hamburg.de/~meine/python_tric...

http://www.siafoo.net/article/52

http://stackoverflow.com/questions/101268/hidden-features-of...

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.

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.

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.
there's a new book out called, 'expert python programming'... check it out if you're beyond 'Learning python'
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.
http://www.pythonchallenge.com/

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.