Hacker News new | comments | show | ask | jobs | submit login
Dive Into Python 3 (online book) (diveintopython3.org)
120 points by helwr 2385 days ago | hide | past | web | favorite | 38 comments



What's interesting is that according to the author Mark Pilgrim:

  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_...


One of the main complaints on Amazon was the poor quality of the printing & publishing, not the actual code or writing style.

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...


I suspect he was just way ahead of the adoption curve on that. I would expect the Dive into Python 3 book sales to pick up.


I don't think it's all that interesting, and it says nothing about Python 3 itself. The choice to write a book on it didn't match up with the demand for a book, and people extrapolated the "disaster" comment too far.


DiP3 is not a very good book. (Neither was DiP.) I don't know how relevant that is to sales, though, but considering that some of the bigger Python groups actively recommend against it, I wouldn't be surprised if there was an impact on sales from that alone.

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 like the style and examples and it didn't make me want to commit suicide like certain repetitive, overhyped, chimpanzee-level Python books have, but it needed 3 or 4 more chapters. The coverage felt incomplete and a little arbitrary.


Why do you think it was bad? (DiP, not 3). No snark.

I have both DiP and PtHW on my Kindle, and I can't straddle both to the end.


If you've never programmed at all in any language the PtHW is much better. If you know how to program, just not how to program in python, then DiP will get you up to speed much faster


This isn't really correct. Zed Shaw (and maybe some others) started a backlash against it, because DITP 2 was so heavily recommended.

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).


#python has been unrecommending DiP since before Zed wrote LPTHW. The #python dead-tree recommendation, for a long time, was How to Think Like a Computer Scientist: http://greenteapress.com/thinkpython/

Lutz' Learning Python dead-tree is also pretty great, from what I hear, although I haven't had a chance to sit down with a copy yet.


At least I found DIP to be a more than decent book (my background before was mostly C and matlab). Certainly not a great book, but I have yet to find one of those for python. The python tutorial is ok if you don't know much about programming, but I found DiP most fast paced.


I second the Python docs, from what I've read so far they're excellent. If you already know another language, the language reference is particularly worth reading:

http://docs.python.org/reference/index.html


What Python book do you recommend for someone who wants to start learning the language? Thanks.


If you aren't new to programming at all, then I'd suggest Python Essential Reference.

Otherwise, I'm still recommending against learning Python the hard way. That might depend on a person, but I don't think typing some samples can make an interesting task, and AFAIKT doing things that are not interesting for you makes learning process a lot less efficient.

Judging from my experience, the best way to start learning the language is having some actual work done (e.g., building a site with Django). Correspondingly, books you'd need are references—Python's docs, Python Essential Reference. You can use LPTHW as a reference, too, just do something more useful than its samples.


Learn Python The Hard Way.


LPtHW is a great book for learning how to program. If you're already a competent programmer looking to pick up python, then you'll probably find it very slow going, and probably better served by something better. I personally learned python from The Quick Python Book, which I thought was quite good.


Does it cover Python 3? I cannot tell from reading http://learnpythonthehardway.org/ - maybe I missed something.


Heh, not exactly:

"A programmer may try to get you to install Python 3 and learn that. You should tell them, "When all of the python code on your computer is Python 3, then I'll try to learn it." That should keep them busy for about 10 years."

http://learnpythonthehardway.org/book/ex0.html (under Warnings for Beginners)


Is that actually good advice?


Yes, that is a good advice.

Someone wanting to learn Python (or any other language) will be better served if they are helped to focus at most important and least painful things first: in this case, python 2 is everywhere with huge number of libraries. Whatever you need is 'pip install' away.

Learning Python 2 is not a waste of time: whatever you learn and is changed in Python 3, will be easily relearned once it becomes needed.


Why's it not a good book? And who are the bigger groups that recommend against DiP3?


I am looking into Python now, because of the job. DiP looks good to me.

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.


I just ordered DIP3 yesterday, after having finished DIP. Since the original DIP was based on v2.33 I am currently missing a lot of new features: decorators, descriptors, meta classes, dictionary and set comprehensions et al. DIP was awesome! and I think I have learned a lot from Mark's pragmatic conversational style.

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_Python


People may complain all they want about the overall book or even Python 3 in general, but the chapter about strings (http://diveintopython3.org/strings.html) is amazingly good and will help you understand a lot about encodings, internal string representation and how to read/write strings to the outside world.

Of 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...


For all the criticisms that DiP gets, it is still the best formatted online book I've come across. The line number/hover over highlight thing is awesome. The code examples are interesting. The explanations are in-depth without spending 10 pages holding your hand.

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.


I'm curious why people consider DiP to be a bad book? I personally can't defend it since I haven't read it


Zed A. Shaw wrote a short critique: http://oppugn.us/posts/1272050135.html . One part of it is rather against Mark Pilgrims unwillingness to update it than against technical points.


"This book is so full of bad initial examples and difficult to follow instructions that it actually hurts Python to have it exist. When beginners stumble onto it they end up getting discouraged and go on to another language. I personally have had too many friends who are eager to learn programming find this festering dung pile before I could warn them and get turned off from programming." - Zed Shaw


I do not agree. In fact, the insanely cool examples are what makes this book worth reading. This book is not for beginners but for programmers who have experience in some other language and are curious to know why python might be a better choice for them as their next high level language.


in fact to reiterate have a look at the awesome fibonacci example showing power of generators [1]:

    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.html


That is, at best, a very high-level 'why', and unnecessarily hostile.


DiP3 is a good book, if you are already familiar with Python. It's not for newbies. In fact, when I didn't know Python I disliked DiP3 to the point of making rude and ignorant comments about it on public forums. Now that I have a humble portion of Python, I like the book and refer to it often. Mark Pilgrim has an engaging style, too. I always appreciate a little style.

If 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'm surprised nobody has mentioned Doug Hellman's great resources. His book "The Python Standard Library by Example" is basically a print version of his PyMOTW project (http://www.doughellmann.com/PyMOTW/). While not an end to end "learn Python" the examples, at least in my case, have led me to ask quite a few questions that open other doors into Python that I haven't been exposed to.

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 agree! After finishing DIP, I am looking for a book to introduce me what all is available in the python standard library.

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...


I have DiP3, and have used it for a couple of tricks, but I found learning Python through Project Euler + documentation to be much more useful.

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.


The Stanford Intro to CS course was the best reference for learning Python that I used. The companion manual was How to think like a Computer Scientist and I thought it was just great. I can't speak to the DIP books, but I would wholeheartedly recommend the references above to anyone I knew.


*MIT Intro to CS and Programming


Yes - thank you :)




Applications are open for YC Summer 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: