
Python in a Nutshell
by Alex Martelli, Anna Ravenscroft, Steve Holden · first published 2002
23mentions
9recommended by
17HN commenters
2008–2024first – last mentioned
53% recommend41% neutral6% critical
Why HN recommends it
A comprehensive, practical reference covering the language in depth, with solid examples. It serves for looking things up and for learning Python quickly, often alongside a tutorial.
Summarised by Claude from recommending comments
xiv, 753 pages ; 23 cm
Affiliate links. As an Amazon Associate I earn from qualifying purchases.








…rewrite something from the activestate's CPAN-loose equivalent, submit it back when it's tested robust and you know it's not a dup http://aspn.activestate.com/ASPN/Cookbook/Python and, oh yea, Martelli's Python in a Nutshell from Oreilly. Covers 2.4, read the PEPs to see what's new in 2.5 and 2.6. Also, Matz's original ruby nutshell on Oreilly, the little one that covers 1.6. It's little outdated, but it's also a small…
on “Ruby java python or lisp” ↗Python in a Nutshell, O'Reilly Media, written by Alex Martelli http://oreilly.com/catalog/9780596100469/ Definitely recommended for learning Python fast&practically. It's the most comprehensive and useful Python reference…
on “Ask HN: ______ is to Python as K&R is to C?” ↗Martelli's Python in a nutshell is the best I have seen on python. Not a cookbook, more of a reference, but this guy is extremely precise and rereading is always deepening my understanding of python.
on “The new Python Cookbook is out ” ↗…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)
on “What did you use to teach yourself Python?” ↗I recommend Python in a Nutshell, 2nd Edition by Alex Martelli. It is very concise, without the newbie stuff, and does point out some specifics that might surprise someone coming from Java and other languages. It's a good Python library…
on “Ask HN: Good Programming Books to Teach Programmers New Languages?” ↗…expand a bit instead. In python there are typed catches, it seems to make a lot of sense to me: you catch only the exceptions you want, and let the other ones bubble up. It is well explained in Martelli's Python in a Nutshell. I have seen try/catch construct in Java and Javascript, and it is probably less readable, and certainly can be over-used, but in Python, returning None in all exceptional cases is annoying, different…
on “Isaacs: try/catch is an anti-pattern” ↗…and precise language, showing a deep love for the language and great craftsmanship. Like you would certainly fall in love with the heroin of a novel you love, I fell in love with... python. The book was Python in a Nutshell, by Alex Martelli.
on “Ask HN: How did you get started with the programming languages you use?” ↗…read some other people's programs. Python is a simple language. Reading other people's programs is a good way to apprentice when learning a new language. The Python Cookbook(s) and the 3rd edition of Python in a Nutshell make good reading. Python comes in two variations these days: Python2 and Python3. Python3 would be the best choice for a new learner.
on “Ask HN: Python?” ↗I'll start it off: - O'Reilly's Python in a Nutshell - A 12" PB (I use my old PB as a more capable "kimble" and for quick SSHing into my servers) - And to preempt the half-dozen comments suggesting them: Founders at Work & Hackers and Painters
on “Ask YC: What would you put on a hacker's bookshelf?” ↗…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.
on “What did you use to teach yourself Python?” ↗Agree with your points. Would add emphasis on ipython and heavy use of interpreter, pylint instead of pyflakes, "learn and prefer builtin modules" rule, and Python in a Nutshell on the desk.
on “Python Ecosystem - An Introduction” ↗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.
on “What did you use to teach yourself Python?” ↗…the 3rd party libraries to be ported to 3.x, start with 2.6. The versions are not different enough for it to be a big problem either way you learn them - but there are more books out for 2.x - like the Python in a Nutshell book, which I find to be the best reference (though not the best book for beginner programmers). Then, you can refer to the "What's New in Version x" entries in the documentation on the Python site to…
on “Ask HN: start with python 2.6 or 3?” ↗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,…
on “What did you use to teach yourself Python?” ↗I think it would be a pretty tenuous thread that links low-interest capital to "Python in a Nutshell" exceeding 700 pages, but I'd like to see it expounded upon. https://www.amazon.com/Python-Nutshell-Second-Alex-Martelli/...
on “Ask HN: Are we overcomplicating software development?” ↗