Contrary to popular belief, not all code at ITA Software is in Lisp. So far all of my work has been in Python. And while Python has been my “quick and dirty” language of choice for many years now, it’s nice to be hacking in Python again for “real” code. The first and last real project I worked on that heavily used Python was Red Carpet back in 2002, and at the time we were targeting Python 1.5 and 2.0.
I really like having hard copies of reference materials on my desk. In a well-organized book, I can look up information faster than I can find it online with the Googling and the clicking and the latency. I also think that it’s probably good for me, since it gives me a break from the harshness of looking at a computer screen for a few moments and takes my hands off the keyboard. It’s a useful and pleasant diversion. When I was working at Novell on Beagle, I always had C# in a Nutshell and Lucene in Action within reach.
While I followed Python’s evolution closely enough to know about some of the newer features like list comprehensions and decorators, my old reference books — the Python Pocket Reference and Python Essential Reference — had gone long out of date and included neither of these nor many more improvements. Picking up the newer edition of the Python Pocket Reference was a no-brainer. A tougher choice was which to choose as my main reference material: the updated Python Essential Reference or Python in a Nutshell.
Based on Amazon’s reviews and my love for the C# Nutshell, I picked up the latter. Regrettably, I made the wrong choice. While it is comprehensive in its content, it feels random in its organization and its index is practically useless. Whereas C# is laid out alphabetically by namespace, making it easy to look up assemblies, objects, methods and properties, Python is laid out conceptually but not in any immediately identifiable order. If you haven’t looked something up before, it’s virtually impossible to do it just by flipping through it. Once you find the large section on file operations, you have to flip through roughly 20 pages before you get to os.path. This wouldn’t be a big problem if I could look up every method, object, and module in the index, but it is woefully spartan. I rely heavily on the indexes of my reference books, and I just can’t find anything in Python in a Nutshell. What are commonly used types that I pass into in a isinstance() call? I could not find them in this book. A large, comprehensive index would do this book a tremendous amount of good and transform it into a great reference for me.
A co-worker had the new edition of Python Essential Reference and it’s at least as good as its previous edition. While it doesn’t have an immediately intuitive layout for a quick flip-through, it has a truly amazing index. Just like the previous edition, I have had no problems finding anything I need, including a list of common types for the isinstance() question I asked earlier. It’s well-written and comprehensive as well. I will certainly pick up another copy for myself.
In summary? For Python reference books, buy Python Essential Reference. The Python Pocket Reference is good for quick stuff, like “what does else mean at the end of a for block?” And Python in a Nutshell, while a well-written book, lacks the organization needed to be a “go to” reference book.