[Tutor] Some first notes on the "Python Cookbook"

Erik Price erikprice@mac.com
Wed, 28 Aug 2002 09:34:39 -0400


On Wednesday, August 28, 2002, at 03:55  AM, Scot W. Stevenson wrote:

> Hi there,
>
> - If you sit down and actually work thru every recipe, you are going to
> learn a /lot/.

That's good to hear.  I feel pretty good about most of Python's basics 
but have been wishing for something like O'Reilly's "Mastering 
Algorithms in Perl", except using Python.  I'm interested in learning 
more about algorithms (b/c I have no CS experience), but I'd prefer to 
work in Python.

> - The book is full of higher level Python programming concepts that I
> haven't seen in any of the three other books on the language I have 
> read
> so far. This might in fact turn out to be the most valuable part of the
> book on the long run.

This is the most appetizing news I've heard about the book, right here.

> 1. Alex Martelli's comparison of the "Look before you leap" (LBYL), 
> "Easier
> to ask forgiveness than permission" (EAFP), and "Homogenize different
> cases" (HDC) idioms in recipe 5.3 on page 169. I don't know if this is
> basic computer science stuff that everbody else learns in Algorithms 
> 101,
> but I found the discussion fascinating.

Does it infer a priori experience with algorithms?  I could run into 
trouble there....

> - There is quite a difference in the background that is expected from 
> the
> reader from chapter to chapter. While Matthew Wood expects you to be 
> able
> to cope with concepts like "reentrancy" [still haven't figured that one
> out] and "thread-safety" in chapter two, chapter three starts off with
> Fred L. Drake explaining the very basic string commands such as the 
> use of
> single or double quotes and splicing.

Hm.

> - A lot of the recipes compare Medieval Python (1.5.2) fragments with 
> their
> Renaissance Python (2.2) equivalents, which provides much-needed 
> examples
> to the new forms such as "super" and generators. Working thru both 
> forms
> show you just how powerful a few lines of Renaissance Python can be, 
> and
> will have you wanting to do everything with list comprehensions, except
> when you can map or filter thru builtin functions.

That's good to hear too -- knowing -when- to use these new constructs 
seems to be just as much or even more of the work as knowing how to use 
them.  Also, I never know when I'm using a new Python construct or an 
old Python construct so that's further fruit from this book.

> Again, I'm only on page 79, so don't blame me if you go out and buy the
> book and it turns out that it really goes downhill from page 80 on. So
> far, I would say that it was well worth my money, and would recommend 
> it
> to anybody who has passed the absolute beginner phase. Having a bunch 
> of
> peer-reviewed code that is extensively commented is second best only to
> places like this list where you can ask all sorts of questions, and
> O'Reilly did a good job of putting it all together.

And betwixt them both, I can lick the platter clean.  Judging from your 
in-progress review it sounds like just the book I have been looking for 
-- great!  (Some of the recipes I saw at 
http://www.onlamp.com/pub/a/python/2002/07/11/recipes.html looked 
interesting, but I will be coming to this list with questions, since I 
don't even know why you would want to use a "singleton".)

 >>> thingsToBuy.insert(0, 'Python Cookbook')




Erik




--
Erik Price

email: erikprice@mac.com
jabber: erikprice@jabber.org