Slashdot Mirror


Python in a Nutshell

Ursus Maximus contributes this review of Python in a Nutshell, writing "Perhaps the best book about Python ever written, this is the perfect capstone to anyone's library of Pythonic books, and also the perfect introduction to Python for anyone well versed in other programming languages. For newbies to programming, this would still be a good second book after a good introductory book on Python, such as Learning Python by Mark Lutz." Read on for the rest of his review. Python in a Nutshell author Alex Martelli pages 636 pages publisher O'Reilly rating Excellent, superb, 5 stars reviewer Ron Stephens ISBN 0596001886 summary Complete reference book for the Python programming language

Written by my favorite author and Pythonista, Alex Martelli, this book manages to fill three roles in extremely pleasing fashion. First and foremost to me, it is a great read, straight through. Mr. Martelli's prose is always sparkling and always keeps the reader interested. No matter how many Python books you have read, you will learn some nuances from this book, and it is about the best review of the whole Pythonic subject matter that I can imagine. While there is absolutely no fluff whatsoever in these 636 pages, it still makes for rather easy reading because the explanations are so clearly thought out and explored as to lead one gently to understanding, without in any way being verbose. It is obvious that Alex Martelli took his time and put in sufficient thought, effort, and intellectual elbow-grease to make this work a classic for all time.

Secondly, this book is the ultimate Pythonic reference book, the best fit to this role I have yet seen. You will keep this book in the most cherished spot on your book shelf, or else right at your side on your computer desk, because you can almost instantly find any topic on which you need to brush up, in the midst of a programming project.

Third, Python in a Nutshell is the most up-to-date book on Python (as of April 2003) and includes the best and most complete expositions yet on the new features introduced in Python 2.2 and 2.3. These topics are not only covered in depth, they are integrated into the text in their proper positions and relationships to the language as a whole. They are explained better here than I have seen anywhere else, so much so as to make them not only understandable to me (a duffer), but indeed so that they appear seamlessly Pythonic, as if they had been a part of the language since version 1.0. Topics explored in depth include new style classes, static methods, class methods, nested scopes, iterators, generators, and new style division. List comprehensions are made not only comprehensible but indeed intuitive.

The book is surprisingly complete. It covers the core language as well as the most popular libraries and extension modules. It is difficult to choose any one portion of the book to highlight for extra praise, as all topics are treated so well. It is a complete book, the new definitive book about Python.

Everything about this book speaks of quality. In addition to the top notch writing and editing, O'Reilly really did the right thing and published this book printed on the highest quality paper, paper so thin that the 636 pages are encompassed in a book much thinner than one would expect for such a size, but strong enough to resist wear and tear. The text is most pleasing to the eye. Holding the book, and turning its pages, gives one a feeling of satisfaction.

Any job worth doing is worth doing well. Alex Martelli and O'Reilly have done justice to a topic dear to our hearts, the Python programming language. Perhaps, in years to come, the passage of time may make this book to be no longer the most up-to-date reference on the newest features added to Python. But time can not erase the quality craftsmanship and the shear joy of reading such a well thought out masterpiece of Pythonic literature.

You can purchase Python in a Nutshell from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page. Ron Stephens would also like you to check out Python City, with "27+ reviews of books about Python. 67+ links to online tutorials about Python and related subjects Daily newsfeed of Pythonic web articles, new sourceforge projects, etc."

9 of 189 comments (clear)

  1. A challenge to smart people... by Anonymous Coward · · Score: -1, Offtopic


    Can any smart/bright/intelligent reader really read the complete content of this page and really understand it ?

    The ultimate truth and nature of universe from human's percpective

  2. Python by Anonymous Coward · · Score: -1, Offtopic

    Python is the future.

    Nutshells are the past.

    So this book must be in the present.

    Given the fact that 90% of all books are written by 1% of the population it's clear that we are being controlled by toads from another dimension if in fact other dimensions exist beyond this dimension which is where that 1% is located depending on how you look at it from different angles till it looks like a fried egg with hash browns on the floor being eatin by bandit dogs from planet x which is going to flip the magnetic poles of the earth killing that 1% that write books about things I don't understand and will never understand why birds laugh so much when I take showers during the winter months when it's cold in fact aren't almost all months winter months except along the equator where none of those %1 live unless they do which is another story what?

  3. teh snakex0rs by WeenisMonster · · Score: -1, Offtopic

    you unimaginative fool, can't you break free from your literalist reality and imagine the possibilities when teh snakex0rs are freed from their nutshells? Let's hope you can take a lesson from this book and "cover it all," including hopefully your head with a plastic bag.

  4. Re:And now for something completely different... by Anonymous Coward · · Score: -1, Offtopic

    "Assaulted", not "assorted".

    Salted peanuts, see, bach?

  5. Pet Python problems by Ed+Avis · · Score: 1, Offtopic

    I've been using Python for a few months now. I hope people won't mind if I post a shopping list of what seem to be missing features in the language, and ask if there is a way round them.

    - Python has 'break' and 'continue' like C. But these only affect the innermost loop. Is there a way to break out of an enclosing loop? (In Perl you can label a loop and then say 'next LABEL', etc.)

    - Failing that, is there a way to get goto statements in Python? They can sometimes be an elegant way to express something, contrary to popular myth. (Eg tail recursion.)

    - How can I pass a variable by reference? For example, to take a reference to a string, pass it to a function and have that function modify the string passed in. More generally, is there a way to store references?

    - Python advertises its support for first-class functions, but I can't seem to get closures to work. The 'lambda' keyword won't accept assignment or even sequencing inside the function body. So anonymous functions you might want to pass around can't do much beyond trivial operations. You can get around this to some extent by making named functions in every case and passing those around, but even then they don't seem to act properly as closures, picking up variables from their local scope. (I'm using Python 2.2.1 BTW.)

    - Is there a do/while statement in Python? Plain 'while' is there but occasionally an 'at least once' loop is what you need. Is there an addon package or library for Python that provides a 'do' construct?

    As you may have guessed, these are the things I really miss in going from Perl to Python. The cleaner syntax isn't a big enough payoff for going without some fairly important language features. The project Vyper sounded very promising in its attempt to add real lexical scoping and functional programming features to Python, but it doesn't seem to be active any longer. A real pity. In the meantime, where I have a choice, I'll keep using Perl, despite its syntactic oddities and historical baggage.

    --
    -- Ed Avis ed@membled.com
  6. Re:Gentoo Zealot translator! by n1cad · · Score: 0, Offtopic

    best. post. ever

  7. Re:A (hopefully) unbiased opinion on Perl v. Pytho by cheese_wallet · · Score: -1, Offtopic

    This comment will probably make it obvious, but I'm not a programmer (not by profession at least). Anyway, here's my question: Why would someone want to implement Python in itself?

  8. Re:Gentoo Zealot translator! (Mod this post) by soorma_bhopali · · Score: 0, Offtopic

    This is the damn good post. Mod this post up

  9. Re:Gentoo Zealot translator! by monsterzero2002 · · Score: 0, Offtopic

    My career was going no where until Gentoo, now I get a job offer a day, at least. My programmer friends look at me with new respect. They know I have taken the right step, and that they soon will too. As for Python, I am convinced it is less powerful than XLANG, which I do everything in now, since it supports dynamic macros and XML. Thank you slashdot!