Stephen McMahon said
How is Python used in real, large-scale projects? How do huge projects with hundreds of committers use distutils, doctests, buildbots and buildout to coordinate high-quality, agile development? This book shows how it's done. As pointed out in another review, it's the "missing manual" -- not for short snippets of cookbook code, but for real development practices.
Packt is a quick-work press, and they obviously didn't provide the kind of polished editing and presentation that some presses provide. But, in my opinion, they made up for it by bringing a book by a real expert to press while the practices discussed are still current. And, while my editor's eye occasionally stumbled on bits of awkward English, Tarek's good sense and generous intellect come through, and more than make up for it.
Willie Pritchett said
I recently completed reading of the Packt Publishing book Expert Pyton Programming by Tarek Ziadé. Overall, as a Python developer, however not quite an expert yet (but working on it), I did find that the book was not quite on the "Expert" level as much of the topics I know as being an intermediate Python programmer.
Expert Python Programming is a useful guide that takes you from the installing Python and setting up your environment all the way through documentation and Test-Driven Development. As I read through the book, as I elluded to earlier, the book isnt so much of an "Expert" book as it is a Python user guide. The book takes you through the Python basics, offers some "intermediate" items, and concludes with "some" expert techniques.
I didnt feel that the book had an overall "flow" to it. The chapters themselves were great from an information standpoint, however, if you didnt follow the chapters in order, you will still come to the same conclusion. For this reason, I consider this book as more of a guide (a book to grab as a reference to a technique).
With all of that being said, I really enjoyed the book. The book gives a "high level" overview of several advanced Python modules such as itertools and offered several techniques different from the way that I have been currently applying functions, etc. Being an intermediate Python developer, the book seemed more for someone with my skillset than an expert.
PROS
* Chapters on good programming practices such as documentation, version control, and testing
* Excellent review on managing your code with Mercurial
* Excellent review on Test-Driven Programming
* Great as a Python users guide
* Gets right to the point on the topics
CONS
* Not exactly an "Expert" programming book
OVERALL
Overall, I feel that this was a great book that I would go back to as a reference. However, I am still on the lookout for an "Expert" level book!
E. Welker said
Let me get my criticism out of the way to start. I liked this book, but thought the title was misleading. The title of the book is "Expert Python Programming." At the very least, I would expect a book that was 2/3rd about the Python language, and 1/3 about development processes/code management using Python. The book was inverted... 2/3 were about development processes, including setting up editors, how test-driven development works, version control, documentation, optimization and profiling, with 1/3 about the language itself. I wasn't totally offended by this because I looked at the book before getting it, but if I had ordered this off Amazon I would have been greatly disappointed. [Maybe it's just me, I find language characteristics and how they're used to solve problems more interesting than tools to build/version/editors etc., but I doubt I'm the only one.]
The material in the book is good. The language specific content can be found elsewhere, and likely in more depth. Sections like the one on optimization were good, but brief.
The best parts of the book (and the majority of the book) is devoted to code management and the development process using Python. I would assume that is where the author's main interests lay, and he references a great number of tools for builds, version control, etc. that the other reviewers here have already mentioned. These sections are great for a intermediate Python programmer that wants to move towards an advanced knowledge, as well as an advanced Python programmer who is looking for a different perspective or possibly a better tool for the job.
I'd say anyone reading my review is taking the correct approach... do a bit of research on this book to determine if it's for you before you buy. This may be exactly what you were looking for... or it may be far from it.
Alex Martelli said
I was very biased in favor of this book to start with -- I got a free review copy, Tarek is a Python committer like me, and I even found myself quoted by name as early as the intro;-). Throughout the book, I kept *wanting* to like it... there ARE plenty of good and useful materials strewn throughout it... but in the end the overall judgment had to be (slightly) negative, because there are just too many infuriating details -- the book's detailed copyediting was clearly something the publishers badly skimped on. I ran out of steam entering errata on the book's site -- there are just too many small errors and not a few not-so-small ones; I didn't even get started on the many, many cases of awkward or outright incorrect English -- clearly the editors of an author who's not a native speaker of English must put particularly care in that (as a non-native speaker and author myself I'm keenly aware of that) and in this case it absolutely wasn't done.
But let's focus on the GOOD stuff: there's a TON of brief but useful summaries of installing and configuring a zillion useful tools (all open source ones which you can freely download from their various sources), from editors to (kinda;-) "linux emulators" for Windows, from automated build and test frameworks to revision control systems both centralized and distributed, and so on. In most cases you'll want to delve deeper into the documentation of specific tools, and of course there are alternative "competing" tools that can are barely mentioned (or not even mentioned), but the vast collection of simple instructions and author's recommendations is quite useful anyway, in many cases even for tasks that _aren't_ related to Python programming.
Almost as useful (and almost as short) is the overview of method for arranging and structuring development, documentation, testing, and optimization -- these parts would be especially useful to students, who typically never get exposed to any of these issues, at all, in college courses on programming and "computer science". Again, you'll want to delve deeper into each subject, but it's a useful thing to have the very basics laid out compactly and logically. Unfortunately, the author has a penchant for _over_simplifying, and particularly for apodictically asserting (with no or insufficient justification) theses and preferences that are far from expert developers' consensus; to get real value out of the book, you need to read it in an extremely critical frame of mind, ready to question each and every assertion with independent research (many you'll find confirmed, many others you won't).
This also holds for the chapter on design patterns, with such egregious claims as "Singletons should not have several levels of inheritance" -- they should have as few as practical and feasible, *exactly like any other class*; the desire to limit the number of distinct instances (which is mostly about STATE) is quite orthogonal to the issues with subclassing (which is mostly about BEHAVIOR). From this original "totally missing the point" follows a classic howler (which I've seen repeated in a review above): "why not use a module?". I have news for you, Tarek: a module supports *ZERO* inheritance -- which is quite a bit stricter than even the unjustified "should not have several level" claim above. Having to completely give up the usefulness of inheritance just because you want to limit instantiation would be a very limiting engineering tradeoff! If there's no need for inheritance then *of course* you want to use a module - DOH! - but if there IS (or if special methods can really help you) then it's not an option.
Some of the Python-specific parts are even weaker -- I was particularly disappointed at the two pages about "how Python deals with memory", which confuse references and objects and thus don't really help the reader at all with this crucial part of "expert Python use". To end on a high note, though, other Python-specific parts here and there are quite useful, and only partly overlap with the contents of other books on the subject -- things such as 'eggs' and testing frameworks such as `nose'. But overall the Python-specific content of this book (particularly the good and useful parts thereof) is surprisingly little for the title, surely less than half.
Overall, I would recommend this book only to a reader who IS prepared for extremely critical reading and double-checking, is not put out by very un-idiomatic English and frequent minor errors (typos in text and code, etc), and who thinks he can get good use out of the best parts of the books, the selective "survey" and summary instructions about many excellent tools and the simplified coverage of development methodologies.
J. Hartley said
[Publisher Packt were nice enough to send me a copy of this, so I'm completely biased, but fortunately I really liked it.]
I've been using Python for a couple of years now, but only on a single project, so while there are parts of it that I know very well, there is doubtlessly a lack of cross-fertilisation in the things I am exposed to. So I was looking forward to this book.
Surprisingly, for such a straightforward-sounding title, it is not at all what I expected.
What I expected was analyses and illustrations of using Python's more powerful features: dynamic designs; creating classes on the fly; functional programming styles; closures and metaclasses.
Sure enough, there is an early couple of chapters devoted to advanced language features. First up, iterators, and generator expressions, and then the .send, .throw and .close methods on a generator, which induce the yield statement to return values or raise exceptions. This is then used to handily illustrate coroutines as a method of co-operative multi-tasking without the calamity involved with getting all multi-threaded. It's exactly the sort of feature I'd pondered writing for myself for a personal project, oblivious that the language provides it out of the box.
Other low-level topics covered include the indispensable itertools module, interesting uses of function decorators, best practices for subclassing built-in types, sensible use of descriptors and properties, understanding method resolution order and using super, the often-overlooked slots, and finally meta-programming and metaclasses.
Interestingly, this list has only one item of overlap with my expectations. Tarek has done a good job of choosing important but sometimes overlooked topics, and while, inevitably, I was very familiar with some of the things he talked about, other sections were complete revelations for me.
However, this is only chapters 2 and 3! The rest of the book expands in scope beyond Python the language, to look at the environments and tools that make up the Python ecosystem. In a way, this sounded less intriguing to me than the computer-science oriented exploration of language features that I had expected. But having finished the book, I now realise that it was exactly what I needed.
The opening chapter goes through installing Python - a topic which I didn't think needed discussion. But Tarek goes on to cover using MinGW and MSYS to set up a credible command-line environment under Windows. I've always used Cygwin for this in the past, and trying out MSYS (coupled with the project Console) is a breath of fresh air.
This cross-platform development environment is then rounded out a little by installing and using things like setuptools, and some thoughtful notes on integrating Python development into editors like Vim and Emacs, or an IDE like Eclipse.
The rest of the book covers some of the major tools in the Python world.
I've never previously been forced to get to grips with Distutils. Applying lessons from the book to a personal project got me completely up to speed with using Distutils to create packages, making source and binary distributions, using eggs, and distributing dependant packages that together make up an application. The only thing really missing from this is maybe generating stand-alone executables using py2exe (for Windows) or py2app (for Macs), although this idea is mentioned in passing.
The following chapters give competent overviews of a wide variety of topics:
8. Version control systems: centralised, illustrated by Subversion, or distributed like Mercurial. Continuous integration using Buildbot. Presumably you will either already know these inside-out or else will lap them up hungrily.
9. Waterfall, spiral and iterative project life cycles. I'm not sure that waterfall is really used by anyone except in case studies of `what not to do', and I'm also not sure how you could be a developer without being aware of this, but maybe that's precisely the point: You can't be a developer if you don't do this. This chapter then covers setting up an instance of Trac and using it to manage a project's deliverables, defects, and milestones.
10. Documenting a project using ReStructuredText and Sphinx, and including hints on good technical writing. This caused me to completely revamp the content of my small personal project's documentation, and as a result it is both much improved, and shorter to boot. Wins all round.
11. Test-Driven Development. This chapter would be a superb overview of the topic for someone who didn't know about TDD. Although I use TDD extensively at work, I've never used nose, fearing that getting to grips with it might be too intrusive or disruptive. In fact, it is seamless to begin using it in a small way and slowly extend into its more advanced features as and when you need them.
12. Optimisation : General principles (ie. don't) and profiling techniques. I had never used the cProfile module described here, having just whipped up homespun profilers on-the-spot whenever I needed them, and it's a valuable addition to my arsenal.
13. Optimisation : Solutions. Big O notation. Correct use of different collection types. Multi-threading, multi-processing, caching. Not much that is tremendously new to me here, but it is obviously a huge topic to cover in a a single chapter, and it covers the bases competently.
14. Design Patterns, and how they apply (or don't) to Python. It has been said that design patterns, as fundamental and necessary as they are to a software engineers mindset, are a symptom a language's lack of expressivity. You shouldn't have to write huge gobs of code to express simple conceptual relationships. Although Tarek never explicitly says this, to some extent it is born out by this chapter. Trivial (and much-maligned) ideas like the Singleton, after a page or two of alternate implementations, boil down to simply `use a module', i.e. zero lines of code. Slightly more complex patterns such as Visitor, are only a few lines. It is still useful to discuss and name patterns, but on the whole reference implementations are so trivial as to be unnecessary, except perhaps as the most concise and precise method of illustration.
The book overall, then, is a grab-bag of different topics. Each chapter could clearly be expanded into one or more whole books. As a result, no part can be covered in very great depth, but Tarek does an admirable job of getting the reader up to speed enough in each area that they can be self-sufficient and direct their own learning from that point.
It's worth noting the the book is based on Python 2.x, buy because of the high-level approach, this scarcely matters. Get a different book if you need to know about the language syntax and features. Get this to find out how to create and distribute Python projects.
As as result of the broad scope of the book it serves as a brilliant annotated laundry list of `things the Python developer ought to know'. While there will doubtlessly be some sections that you are already deeply familiar with, if you have any interest in discovering your own deficiencies as a Python programmer, I can highly recommend it.
Comments