Hacker News new | comments | show | ask | jobs | submit login
Ask YC: What is the best Python book for a beginner?
15 points by rob 3165 days ago | hide | past | web | 23 comments | favorite
I'm looking to learn more about Python and want to buy a book to read in my spare time (and I do know of the online Python docs, the free Dive into Python website, etc). Can anyone recommend a book that is up-to-date (i.e., covers 2.5)?

Looking at Amazon, I'm leaning towards Learning Python, 3rd Edition (http://tinyurl.com/2az6zh). Any opinions on this one?

Thanks for the help.

Why not read Dive into Python -- it's excellent -- and then learn about the new stuff in 2.5 later. The new stuff gives minor efficiency improvements, but Dive into Python is plenty good.


here's the web link to the book: http://www.diveintopython.org

Have you tried O'Reilly's Safari service? For 14 bucks a month, you get a subscription that will let you have access to 10 different books at a time. That way, you can read different chapters on the same subject.

I tend to bounce around in what I learn and try to look at things from different angles. I find that different authors cover one subject better than another. And, thay way, I don't have to feel bad about buying the book and only reading 2-3 chapters out of it.

When I started, I read "How to Think Like A Computer Scientist: Learning With Python" Since then the revised edition has had a draft out, " How to Think Like a (Python) Programmer". This series is really good at getting the basics down clearly and quickly (I read through it in under a week). After that, Dive into Python fleshed things out more for me.


I'm not a big fan of the O'Reilly books on Python, but if you prefer the style of Learning Python, you can't really go wrong. Most of the basic Python tutorials teach more or less the same material, so you won't miss too much by choosing one tutorial over the other.

I personally recommend How To Think Like A Computer Scientist (http://openbookproject.net/thinkCSpy/). It doesn't cover everything in 2.5, but I think most of the stuff in 2.5 you're better off just reading the release notes after you have a basic grasp on the pre-2.5 stuff. You're going to be reading a lot of code to master the nuances of Python, and most of it is pre-2.5 Python, so you should know it well.

If you want to use that book, there's also assignments and projects available from UC Berkeley's self-paced Python course, CS 9H, at http://www-inst.eecs.berkeley.edu/~selfpace/cs9honline/ if you want more structure.

I read about half of Dive Into Python, and it was pretty advanced stuff. It's good if you know another programming language very well. The book starts out slow, but the difficulty curve accelerates very fast. I wouldn't read it cover to cover. It would be a good reference to have though.

I'd suggest skimming the table of contents of both books first.

Then again, Dive Into Python is free, so you might as well start with that, and if it's too advanced, switch to Learning Python (I read the first 100 pages of it last summer, and I thought it was good, I'm a fan of O'Reilly).

If you really want a beginner book, Learning Python is a great choice. It was just updated too. Good luck.

"Beginning Python - From Novice to Professional"

I'll back you up there. It's what I'm using and it is wonderful except for one thing: it doesn't have that much real and difficult examples throughout, only some sprinkled here and there and the rest of the scripts are nonsense.

P.S That is before the last chapters in which the books gets really interesting. But it'd be nice to have those projects in between chapters as you learn instead of at the end of everything.

If you want to learn Python and are interested in gaming, you could write some scripts for Counter-Strike: Source / HL2 / TF2:


Tutorials (some are pure Python, others are game-related:


One kinda neat example:


I found Core Python Programming by Wesley J. Chun is the best python book so far that I requested the university library to get it (among couple other books) for my research.

I started with Beginning Python: From Novice to Professional. Extremely helpful and easy to follow book, since I already have few languages in my repertoire.

After you are comfortable with python and its syntax then get some python cookbooks.

Good Luck

Yep, I know what you mean. I've got the O'Reilly "Learning Python" book, but I'd love something that covered soup to nuts. Start with a python interpreter, suggest and IDE (EasyEclipse for LAMP?) and get me to Django.

Maybe I'm being lazy, but more practical, show me, types of tutorials work best for me.

I found Learning Python + the python tutorial by Guido on python.org to be a great way to start

Learning Python is an excellent book. It is what I found most useful for learning the language. I bought and read many books, and this one is the best I found. Conversely, Programming Python sucks, even though both are authored by the same person. (LP is co-authored.)

The language docs from python.org are invaluable as a reference, which includes the tutorial. I invariably download the html tarball and put it on any machine I use for python programming.

If you're posting here, presumably you know how to program already. In that case working through the free "Dive into Python" PDF really is the first step you should take. After the first seven chapters you should then be able to make do with the online docs (the remaining chapters cover specialized material like HTML parsing, SOAP calls and test based development which are, in my opinion, not the first thing you should be worried about when learning a new language).

"Learning Python" and especially "How to think like a computer scientist" are targeted towards people with very little programming experience. If that's you, my vote goes to "How to think like a computer scientist" (ymmv).

The Wikibooks article has quite a few useful sections, including at least one link to a page of free Python books.


http://www.pythonchallenge.com/ is also a great way to learn (albeit secondary to a standard book)

I found the python challenge incredibly hard. Not programming-wise but it's just really hard to know what to do next in most puzzles.

I'd rather recommend http://projecteuler.net

If you already know any other (good) programming language, then "Essential Python Reference" by David Beazley is the way to go. For starters, if you are wondering, this is how I would do it in X, I wonder how to do this in Python - this book would get you the answer the fastest. There is also a detailed introduction (about 70 pages or so, IIRC) that will get you started as well.

I went through "dive into python", "learning python", and the python cookbook by oreilly, in that order. If I had to do it again, I would skip dive into python which I found a bit easy. Cookbooks are usually dry and this one is too, but it does beef up your skills.

Dive into Python is great.

I started learning Python from a Mark Lutz seminar actually. He is a great teacher.

You'll find a limit to your knowledge of python if you just start hacking. Knowing C and how python is built help build an intuition for how things really work. I find it invaluable.

Programming Python or Core Python. Both from the O'Reilly collection.

Dive into Python by far, for me at least!

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact