Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!


Forgot your password?
Books Python Book Reviews

Book Review: Effective Python: 59 Specific Ways To Write Better Python 71

MassDosage writes: If you are familiar with the "Effective" style of books then you probably already know how this book is structured. If not here's a quick primer: the book consists of a number of small sections each of which focus on a specific problem, issue or idea and these are discussed in a "here's the best way to do X" manner. These sections are grouped into related chapters but can be read in pretty much any order and generally don't depend on each other (and when they do this will be called out in the text). The idea is that you can read the book from cover to cover if you want but you can also just dip in and out and read only the sections that are of interest to you. This also means that you can use the book as a reference in future when you inevitably forget the details or want to double check something. Read below for the rest of Mass Dosage's review.
Effective Python: 59 Specific Ways To Write Better Python
author Brett Slatkin
pages 227
publisher Addison-Wesley
rating 9/10
reviewer Mass Dosage
ISBN 978-0-13-403428-7
summary helps you harness the full power of Python to write exceptionally robust, efficient, maintainable, and well-performing code.
Effective Python stays true to this ethos and delivers 59 (not 60, nope, not 55) but 59 specific ways to write better Python. These are logically grouped into chapters covering broader conceptual topics like "Pythonic thinking", general technical features like "Concurrency and parallelism" as well as nitty gritty language details like "Meta classes and attributes". The range of topics is excellent and cover relevant aspects of the language that I'd imagine pretty much any developer will encounter at some point while developing Python programs. Even though there is no required order to reading the various sections if you want to read the book from cover to cover it's organized in such a way that you can do this. It starts off with getting your head around coding in Python before moving on to specifics of the language and then ending with advice on collaboration and setting up and running Python programs in production environments.

I really enjoyed the author's approach to each of the topics covered. He explains each item in a very thorough and considered manner with plenty of detail but manages to do this while still being clear and concise. Where relevant he describes multiple ways of achieving a goal while contrasting the pros and cons of various alternative solutions, ending off with what he considers the preferred approach. The reader can then make up their own mind based on the various options which applies best in a given situation instead of just being given one solution. The author clearly understand the internals of the Python language and the philosophy behind some of the design decisions that have resulted in certain features. This means that instead of just offering a solution he also gives you the context and reasoning behind things which I found made it a lot easier to understand. The discussions and reasoning feel balanced and informed by the experience of a developer who has been doing this "in the trenches" for years as opposed to someone in an ivory tower issuing dictates which sound good in theory but don't actually work in the real world. The vast majority of the topics are illustrated through code samples which are built on and modified at each stage along the way to a final solution. This gives the reader something practical they can take away and use and experiment with and clearly shows how something is done. The code samples are easily comprehensible with just enough code to demonstrate a point but not so much that you get distracted by unnecessary additions.

While most of the topics are Python specific plenty of the best practices and advice apply equally well to other programming languages. For example in one section the author recommends resisting some of the brevity offered by the Python where this can lead to unreadable code that is hard to understand but the same could be said of writing code in many other languages (I'm looking at you, Perl). This also applies to a section related to choosing the best data structure for the problem at hand — if you end up nesting Maps within Maps in your code then you're probably doing something wrong regardless of the language. Still, the main focus here is Python and the author does not shy away from going deep into technical details so you'll definitely need some knowledge of the language and ideally some experience using it in order to get the most out of it.

Effective Python is not a book for complete newbies to Python and I think it's suited more to intermediate users of the language wanting to take their skills to the next level or advanced programmers who might need some fresh takes on the way they do things. The subjects and opinions in this book could either convince you to do something differently or reassure you of the reasons why you're already doing things a certain way (external affirmation that you're right is also useful at times!) I'm no Python expert but I found the book drew me in and kept my attention and I certainly learnt a lot which will come in handy the next time I put on my Pythonista hat and do some Python coding. Highly recommended.

You can purchase Effective Python: 59 Specific Ways to Write Better Python from amazon.com. Slashdot welcomes readers' book reviews (sci-fi included) -- to see your own review here, read the book review guidelines, then visit the submission page. If you'd like to see what books we have available from our review library please let us know.
This discussion has been archived. No new comments can be posted.

Book Review: Effective Python: 59 Specific Ways To Write Better Python

Comments Filter:
  • It always makes me giggle whenever this "tech" site publishes a review of something static and made of dead trees.

    How about firing up some reviews of blogs for people who like to keep up with emerging tech instead?

    • You assume that books cannot change, but books kept in an electronic format can, and do, receive updates.

      Especially when your provider is threatened with a lawsuit of some kind and they pull it from your account.

    • by Anonymous Coward

      I know what you mean.

      It always makes me giggle whenever someone comments on this "tech" site and exposes a laughably narrow and counterproductive view of programming tools, computers, or anything else related to technology.

    • Did you stop giggling when you found out it's an e-book?

    • by doom ( 14564 )

      It always makes me giggle whenever this "tech" site publishes a review of something static and made of dead trees.

      You know, perl programmers never say anything quite as inane as this.

      • Or COBOL ones. Mind you, most of them don't know what interwebs are so you're unlikely to ever meet one unless you walk into a pub and there's a Fairport Convention tribute band playing.

        • Hey COBOL is awesome, especially the SCREEN SECTION :)

          Why futz about with (n)curses for a day when you can knock out a beautifully laid out text UI in a 10 minutes!

          (I'm 50% serious here..)

    • by HiThere ( 15173 )

      That's interesting. Enjoy your giggles. I've got one screen, and if I'm programming, that's what I want to use it for. I find a book doesn't shove my program into the background, cover it up, and attempt to hide it. And this is even without using something that trys to pretend that the front application is the only one I could possibly be interested in seeing.

  • Hisssssss

  • What, 59 ways? With python it should just be *one* way. (And if you're going for clickbait it should be *69* ways.)
  • Start with an actual design you goddamn python script-kiddies.
    Just kidding! :-)

I've got a bad feeling about this.