|
52 of 56 people found the following review helpful:
3.0 out of 5 stars
Half-cooked, September 6, 2005
Good:As other reviewers have pointed out, this book offers solutions for a broad range of programming problems. There is something for every level from beginner to expert (the most advanced examples were well over my head). The recipes are enhanced by discussions that are mostly very well and clearly written, giving insight into the design and logic of the presented recipes. They thus guide the way to adapting the recipes to your own programs. So, most of the content of this book is good. 4-5 stars for that. Bad / Production: The recipes (so I gather) are mostly edited versions of what is available at ActiveState's online cookbook. However, the edited versions seem not to be available online (at least there is no pointer, and O'Reilly's website does not provide one either). Nor does the book include a CD. For all the hype in the book about this being a book by the Python community for the Python community, this is disappointing. Not even pointers are provided to on-line cookbook recipes that were used as starting points for those printed in this book. This is just bad craftsmanship on the part of O'Reilly. (On a similar note, the back cover promises a foreword by Guido but there isn't one.) Bad / Content: Sugar is sweet but bad for your health. So it is with this book - too many recipes add only (syntactic) sugar but no minerals and vitamins. Several 'shortcuts' are just wasted ink and breath - they will save you 1-2 lines of code when writing a function but then you have to import the shortcut implementation and get to make the extra function calls... Where these 'shortcuts' help to avoid some Python gotchas, it would have been more useful to just document the gotcha in question and show how to avoid it in straight Python code without any sugaring. Case in point: The once-only initialization of function default arguments. If you write: def foo(bar=[]) bar.append(quux) then previous quuxes will be lurking in the bars of every subsequent foo call that does not pass bar itself. So, you must write: def foo(bar=None): if not bar: bar=[] to get an empty [] for every call. Now does this 'problem' merit a more elaborate, sugary 'solution'? I don't think so. Some recipes are recipes for disaster. We are told how to automatically call the __init__ routines of every superclass... what we are not told is how to automatically call them in the appropriate order or with the respective arguments for making things work. How often do you write an __init__ that takes only the 'self' argument? Sure, it occurs, but... The omission of implicit superclass calls was a conscious design choice in Python and a wise one at that. Too many recipes like this one just want to show you how to subvert Python's conscious design choices. The sweet taste won't last but give way to heartburn. For a book of this scope and design it is of course impossible to avoid criticism of the kind 'why did you include A but not B...' Still, here goes: XML: There are excellent libraries such as ElementTree and now cElementTree that offer fast, clean and 'Pythonic' alternatives to the standard library modules for XML parsing. More than just a URL pointer should have been provided. Web programming: Only Jython and Twisted are mentioned as alternatives to CGI. Now Twisted may be the greatest thing since sliced bread, but ordinary mortals will never know, because it has about the the most confusing and unfathomable documentation of anything on the web (ooh I forgot Zope...). Presenting Twisted 'recipes' (or rather, plugs) with 'discussions' that drone about its power but are again just the same handwaving stuff as in the on-line docs is useless. (If you just want to get your web stuff done with minimal pain: For simple PHP-like embedded scripting but with the advantages of Python, look at Spyce, and for an easy application server, look at Cherrypy or Webware). So, altogether, a good book but not quite on par with e.g. Python in a Nutshell.
|