Geeky book: Foundations of Python Network Programming by John GoerzenVery good; a couple of minor
disappointments
John
Goerzen
Foundations of Python Network Programming Apress, 2004 ISBN: 1-59059-371-5 $44.99 489 pages (main text) I am (said to be) an expert on the Python programming language. But I picked up a copy of Foundations of Python Network Programming because, expert or not, there's plenty that I can learn. I did learn some things from the book, and I'll be glad to have it as a reference too. Part one (of six) deals mainly with using socket objects directly. Python's socket module is a pretty thin wrapper over the underlying C implementation, so you do things like listen() and bind(). I know that stuff, but that's not the same thing as always getting it right the first time. When I next need to hack up a client or server that works that way, I'll probably start by looking at Mr Goerzen's sample code and save myself fixing a couple of bugs. The other parts are also good. There's no need for me to list them here, you can read the table of contents on the author's site. I learned a bunch from the sections that are about things that I don't know much about (mod_python and pyOpenSSL, for example) and the things that I do know were generally explained very well. I do have a couple of quibbles. Despite the credit that the book's copy editor gets in the acknowledgments, the text isn't especially elegant. For example, there's "review your files" where "review the files" would be better (p. xix) and "have their" where "has its" would be better (p. 9). Domain name service is referred to as "the DNS" (p. 4) and just "DNS" (p. 7), and there's an unnecessary "actually" (p. 39). Mr Goerzen generally writes introductions and conclusions in the "Tell them what you're going to tell them, tell them, then tell them what you've told them" style. I suppose that's forgivable in a technical book, but it doesn't make for very interesting reading. And there are some other clunky bits. For example, the first sentence of chapter 14 is: "Databases in different forms are becoming quite commonplace." (p. 295) The only significant complaint I have about the book's approach and organization is that I think it's a trifle unfortunate that Mr Goerzen introduces the Twisted networking framework at the same time that he introduces clients for the IMAP4 protocol. I've never used Python's imaplib module, but I'm willing to believe Mr Goerzen when he says that Twisted's IMAP support is better and that it makes sense for him to use Twisted for IMAP. The problem is that Twisted is a networking library that works in an unusual way and IMAP is a very heavyweight protocol. Twisted is sufficiently unusual that the reader would have been better served if Mr Goerzen had begun explaining it by using it to do some pretty simple things. Perhaps by re-implementing some of his earlier examples using it. We also learn a bit about Twisted's server support in a short (4 page) section at the end of the chapter on asynchronous servers. For Twisted, we get two imperfect looks at it rather than a really useful introduction. I think that's unfortunate, but it may bother me more than it bothers most readers. I bought the book partly in the hopes that it would provide a reasonably painless introduction to Twisted. I've looked at Twisted a couple of times and it seems cool and potentially very useful. But I haven't yet needed it and so I haven't gone to the trouble of installing it and figuring out how to make it work. I had hoped that, having read the book, Twisted would seem reasonably simple and obvious. Instead, I think I have only a bit of a head start on making sense of Twisted's documentation. For a similar reason, I was also hoping that Mr Goerzen would talk a bit about Python's asyncore and asynchat modules, but they're only mentioned. That's a very minor quibble: the book is already a bit over 500 pages with its index and it's called Foundations of Python Network Programming, not Absolutely Everything There is to Say About Python Network Programming. I have two technical quibbles: In the sample code demonstrating retrieving mail using Python's poplib module, it's not clear why Mr Goerzen creates an email Message object out of the data before writing it to disk (p. 217). In describing the similar functions select() and poll(), Mr Goerzen says, "The poll() call tends to be preferred on modern systems...." (p. 469) I don't think that's sufficiently obviously true that it doesn't need any justification. In all, the books delivers on what its title says and I plan to put it on one of my bookshelves that I can easily reach. The publisher's site has a sample chapter and the example code available for download. Posted: Thu - February 17, 2005 at 08:07 Main Category: |
Quick Links
Calendar
Categories
Archives
XML/RSS Feed
Me
Statistics
Total entries in this blog:
Total entries in this category: Published On: Feb 17, 2005 08:46 |