Python 3 is a commercial disaster. In 2010Q3 I had
negative sales of DiP3. More people returned it than
bought it. I'm considering retro-fitting the book's
content to Python 2.7 and re-releasing it as "Dive Into
Python 2." Seriously.
http://www.reddit.com/r/IAmA/comments/f545e/i_am_a_fourtime_...Personally, I love the web version and was going to purchase it, but decided not to because of all the issues people had reported on amazon
http://www.amazon.com/review/R1JSR2ZJ2Q585D/ref=cm_cr_pr_vie...
Edit: I don't recommend learning Python from a book. I recommend http://docs.python.org/tutorial/ if you know a programming language already, or http://learnpythonthehardway.org/ if you don't. (Yes, I know there are dead-trees of both of these.)
I have both DiP and PtHW on my Kindle, and I can't straddle both to the end.
It does have a couple of weaknesses. Starting with ODBC is kind of lame, and should be updated to Sqlite. And SOAP needs to be taken out the back and shot, but that's just my opinion.
I'm sure Learn Python The Hard Way is pretty good, but DITP was the second place most Pythoneers were sent to (after the tutorial you pointed out, of course).
OTOH, the book might arguably now work in my case, since I am considering updating my rusty web mojo (+) and sending out the CV instead... :-)
I like the elegant, minimal notation. Tastefully designed. But... the inflexibility gets to me. (It must be unique in a modern language that have lambdas/list comprehensions/etc with just single [edit:] statements?!)
(+) I hope I didn't mangle the idiom too badly.
Regarding DIP3. As someone pointed out that the new book has not gained much traction since its release in late 2009. But I have a feeling this might have changed now with v2.7 release with which most of the v3 features have been back ported to 2.x already and I am wondering if it's actually safe to read this book while using v2.7.2?
Many of its major features have also been backported to the backwards-compatible
Python 2.6 and 2.7. [1]
[1] http://en.wikipedia.org/wiki/History_of_PythonOf course a lot of the chapter is python 3 specific, but IMHO p3's handling of strings and encodings is very well done.
Provided that the strings you are going to deal with can be represented in Unicode, which still isn't always the case: http://en.wikipedia.org/wiki/Han_unification#Rationale_and_c...
I learned quite a few cool Python tricks from DiP and it was the first book that got me excited about programming. I remember reading the chapter on list comprehensions and thinking they were the coolest thing ever (and I still love 'em!). Whether or not all the code is 'pythonic' or uses deprecated methods, it was still worth reading in my mind.
def fibonacci(max):
a, b = 0, 1
while a < max:
yield a
a, b = b, a+b
To run the function do: >>> for n in fibonacci(1000):
... print n,
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
[1] http://diveintopython.org/dynamic_functions/stage6.htmlIf you are looking for an intro book, go with Zed Shaw's "Learn Python the Hard Way." There's another guy with lots of style.
I like what Zed has put out, but the books Lutz has out are great as well. Hetland's book is OK and Paul Barry's "Head First Python" is a great read if you're a true beginner to get your feet wet with a fun book. It's an easy read, but I would think that the transition to "Learning Python" would feel like a slight step backwards - however "Programming Python" by Lutz may be a better logical step (instead of going back through a lot of the basics).
I could use the official python library [1] but I usually prefer reading away from the computer and then getting back to get some actual work done; so I am looking for a dead-tree book.
Currently I am thinking b/w PER [2] or PSL by Example [3]. I see that PER gets referred to everywhere but that could also be due to the fact that it came out in 2009 and PSL by Example just came out last month.
On a quick look, it seems PSL by Example gives more of a tutorial feel (which I think is great!) whereby PER is essentially a reference. What would you recommend?
[1] http://docs.python.org/library/
[2] http://www.amazon.com/Python-Essential-Reference-David-Beazl...
[3] http://www.amazon.com/Python-Standard-Library-Example-Develo...
Also, having learned Python 3 first, I can't stand porting things to Python 2. It's like taking a final draft of an idea and trying to turn it into a rough draft.