24 ms·
Learn Python the Hard Way
- dsego 12y agoah, Python, the language where you have to learn for in range() before even knowing functions or lists. Just memorize this, we'll explain it later...
- QuercusMax 12y agoAfter reading the Intro and first chapter - is this a joke?
- SpaceInvader 12y agoWhy you think it is a joke?
- LeonRobrotsky 12y ago> is this a joke? No, just written by Zed Shaw. Honest mistake though.
- JanezStupar 12y agoBe advised that this kind of plugging and low grade humor is frowned upon on this site. Go read the https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html if you haven't yet.
- ColinWright 12y agoIf you're already a programmer, it's not for you. If you're not already a programmer, no, absolutely it is not a joke. Having taught people to program for many years it's some of the best advice I've seen.
- piqufoh 12y agoDid you read the whole intro? > Sometimes people who already know a programming language will read this book and feel I'm insulting them.
- QuercusMax 12y agoI saw that part. Still triggered my "maybe and elaborate troll" detector. He doesn't explain why he's doing it this way.
- JanezStupar 12y agoYou are triggering my "maybe an elaborate troll" detector. Especially as the GP has already referred to the intro, which you have supposedly already read. So let me point it out for you again: http://learnpythonthehardway.org/book/intro.html http://learnpythonthehardway.org/book/intro.html He goes into great detail arguing why he thinks this is one of the best ways to learn something completely new quickly and efficiently.
- QuercusMax 12y agoThe first lesson literally consists of "run python interpreter, then quit". How is this a useful way to approach things? He compares it to learning to play guitar - if my first guitar lesson consisted of "Open your guitar case. Take out the guitar. Put it back.", I'd ask for my money back!
- JanezStupar 12y agoEverybody goes through a stage where they have no idea what anything on their computer screen means. Some of them have the luxury of having a mentor walk them through and teach them the ontology of "the computer". Similarly one needs to learn the ontology of "computer programming". And this tutorial is not meant for snotty CS program graduates, which again is explained in the introduction, which you to this time refuse to read and understand. If you have a teacher worth his salt, he will have you open the guitar case and teach you about what the instrument is, what its parts are, how you are supposed to handle it and take care of it. At least that is what my trumpet teacher taught me when I started out.
- kcole16 12y agoIf you have a programming background, the official docs are the best way to pick up Python. This is for beginners, and it helped me a lot when I was starting out. It's not perfect, but it's a great way to get started.
- coldtea 12y agoI don't know. Is this a content-less accusation?
- ghost91 12y agoAnd still not using python3.X …
- volent 12y ago"A programmer may try to get you to install Python 3 and learn that. Say, "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. I repeat, do not use Python 3. Python 3 is not used very much, and if you learn Python 2 you can easily learn Python 3 when you need it. If you learn Python 3 then you'll still have to learn Python 2 to get anything done. Just learn Python 2 and ignore people saying Python 3 is the future." I don't think it is useful for a beginner to start with python3.
- ghost91 12y agoNearly all packages are ported to python3. There are still some bigger projects missing, but these are exceptions and not the norm. Python3 simplifies many aspects of the language, for example handling of bytes and handling different encodings. In my day to day use I don't want to miss these features. Many interesting features where added in 3, like yield from, more powerful generator syntax and the libraries multiprocessing and pathlib.
- cookiecaper 12y agoWell, this quote is a little pessimistic because now almost everything is either Python 3 compatible or has been replaced with something that is and it's only been 7 years. :P Even NumPy and SciPy work on Python 3 now, and it's not like there are massive differences between Py2 and Py3 anyway, so generally speaking it shouldn't be hard for a noob to revert to Py2 if it becomes inexplicably necessary. It's time. All new code should be in Python 3.
- falcolas 12y agoCall me when I can get system packages for all of these libraries (particularly those with shared library dependencies) in Python3. It will happen someday, but not yet.
- napolux 12y agoSo, is it good or not? :D
- SpaceInvader 12y agoFor beginner it's pretty decent. I enjoyed it few years ago (probably that was some older revision).
- dagw 12y agoIf you're new to programming, it's pretty good. If you're an experienced programmer looking to pick up python, then it is very slow going and takes a while before it gets anywhere interesting. Basically it should really be called Learn Programming The Hard Way Using Python
- M8 12y agoBut then it will be confusing, people will assume that scripting is the same thing as programming.
- collyw 12y agoI used to find Dive into Python a good resource when I was moving from Perl to Python.
- dagw 12y agoI used The Quick Python Book when making the same transition years ago and thought it did a good job.
- 12y ago
- las_cases 12y agoWow, how come Zed Shaw manages to attract so much hate? I have found his series to be absolutely delightful. Anytime something about him appears on HN I can be sure there will be users with ad hominem attacks like this: "> is this a joke? No, just written by Zed Shaw. Honest mistake though." How about you let go of the hate and embrace some love instead for the work this man has put forth? LE: For advanced Python you can read his code from the Lamson project. I am sure there are many other coders out there who are just as talented as he is but he takes the time to comment his code and also has a style of clarity so to speak. Thank you Mr. Shaw for your work and thank you to all of the amazing, talented coders out there who gave me confidence and helped me to learn.
- austenallred 12y agoZed can come off as defensive and/or abrasive. If he disagrees with you he's not afraid to tell you you're an idiot, and if he feels like you're attacking him he'll tell you to go fuck yourself. He's also very, very staunch in his beliefs, some of which are somewhat contrarian. In an industry as opinionated and "willing-to-call-you-out" as tech is, that doesn't always win a lot of friends.
- EliRivers 12y agoI can't think of any industry in which insulting someone because you disagree with them will win friends :)
- pbhjpbhj 12y agoCelebrity industry - it's the modus operandi of some entertainment journalists. Or, did I miss some implied sarcasm??
- EliRivers 12y agoNo sarcasm intended. I live a very sheltered life and in my circles, bad manners gets people cut off, ignored and relegated; certainly doesn't win new friends. HN is pretty much the only place I don't bother with manners. Does it win these journalists friends, or followers? I suspect the latter, but in the celebrity industry, they're probably the same thing.
- druml 12y agoI have been waiting for the completion of Learn C the Hard Way for a while, BTW.
- VinzO 12y agoSame here. I pre-ordered it on amazon back in 2013! I am getting pissed as every few weeks I get an email informing that the released date is postponed again.
- zedshaw 12y agoMe too, man that book has been an epic slog. I've ended up rewriting it like 10 times but finally have a draft off to the publisher for editing. I'm still not totally happy with it, but it's the best I could possibly do. The latest rewrite emphasizes secure coding and defensive programming practices, algorithms, testing, and how to learn a new programming language, and simply uses C in as safe a way as possible to do that. Hopefully it's effective but I still need to sit with students in IRL classes to test that out better.
- AlexeyBrin 12y agoAre you going to update the online version once you publish the printed version ?
- cdnsteve 12y agoLoved the "A Warning for the Smarties" part.
- Psion7 12y agoWhy is this at the top of HN? Didn't the 3rd edition come out ages ago? What exactly is new?
- piqufoh 12y agoHN has a ranking system which differs to reddit etc. You'll be seeing what's "hot" as ranked by the algorithm http://amix.dk/blog/post/19574 http://amix.dk/blog/post/19574 If you're looking for what's popular, check out https://news.ycombinator.com/best https://news.ycombinator.com/best
- benihana 12y ago>Why is this at the top of HN? Because a bunch of people voted it up because it's relevant and useful to a bunch of people even though it's been on HN before. Can you believe it?
- yitchelle 12y agoIt is interesting that one of the way Zed advocates for learning is to type, (instead of copy and paste), the code into the computer. That reminds me when I was cutting my teeth at my introduction to computers. I would get computer magazines like Compute! and type in the 100s of lines of code that comes with it. Especially the arcade games listing. I think this method also improve my debugging skills as I was tracking down the error (usually I did not type in the code properly or there was a misprint in the magazine).
- jussij 12y ago> Zed advocates for learning is to type, (instead of copy and paste) The copy an paste option is always attractive, as it gives the impression of writing lots code quickly. But I agree with Zed in that it leads to a false premiss of being productive. Coding is all about typing in code, not copy and pasting code. It's actually quite hard to type in lots of code without generating compiler errors. But it is quite easy to just copy and paste code without error. So the copy an paste option leads to a false sense of coding ability.
- tragic 12y agoI think the bigger issue is that coding is about knowing what the hell you're doing. Copying a snippet manually forces you, as a side effect, to read the code, and read it more slowly than you otherwise would. You notice the limits of your understanding more quickly, and can try to fill them in. I didn't learn with Zed's books, but I did (and do) avoid copying and pasting anything I didn't (don't) understand, and would recommend that approach to any newbie.
- enobrev 12y agoTyping it out definitely helps with muscle memory. Every time I start trying to learn a new language, I make sure to type out all the examples I hunt down while trying to implement something. Whether it's whitespace, or semi-colons, or brackets. After a couple days of typing everything out, they become second nature and I don't have to worry as much about syntax as I do about thinking in whatever way the language seems to flow.
- deleted 12y ago[deleted]
- zedshaw 12y agoThat's a rather slanderous thing to say, and I honestly wish programmers would quit this fear mongering of others in the profession. I do it too, but lately I've been saying that we need to stop it. You've never met me in person, so read some of the comments from people who have. By saying that I should never work with people you are effectively attempting to prevent me from having a job. That's an incredibly abusive thing to do to someone else, and it's just an odd thing to do in a professional setting. Based on this, I wonder how you are to work with? Are you the kind of person who goes around getting people fired? Are you to be trusted in your opinion of others if it's so easily swayed by public opinion? Are you potentially racist or at least blindly biased? See how that works? It's possible to take anyone's words and, with a bit of grammar jujitsu, use it to destroy someone else. I've recently tried to stop saying people shouldn't work with someone or that I won't work with others, and I have been meaning to write about it. Hopefully my comment will make you feel the same way.
- deleted 12y ago[deleted]
- munchhausen 12y agoSo I'm scrolling through this comment section, thinking, "Are we ever going to talk about the book or what?". This thread is proof that programmer types need their share of celebrity gossip as much as anyone :) "That Zed Shaw. He's abrasive, but is he too abrasive? Tune in to our panel discussion to find out!"
- qzcx 12y agoRight? I came to the comment section to post something I found funny in the introduction... but I'm afraid people will get offended by it now. "If you are reading this book and flipping out at every third sentence because you feel I'm insulting your intelligence, then I have three points of advice for you: 1.Stop reading my book. I didn't write it for you. I wrote it for people who don't already know everything. 2.Empty before you fill. You will have a hard time learning from someone with more knowledge if you already know everything. 3.Go learn Lisp. I hear people who know everything really like Lisp."
- dsego 12y agoIf you know anything about programming, skip this book. If you don't know anything about programming, also skip this book. It gives you drills without explaining anything. My SO started learning with this book and I could see the book only caused confusion. She completely misunderstood how functions and function invocation work. And his way of teaching boolean logic is to memorize truth tables, wtf?
- joshuapants 12y agoI agree. I suggest the Head First series by O'Reilly. They are much more beginner-friendly and the teaching method is based on research and not some crufty old belief that learning should be "hard."
- brudgers 12y agoThe pedagogy of Learn Python th Hard Way is called 'Direct Instruction'. It has been successful for teaching the very rudiments of diverse subjects. It falls flat once applied to teaching creative intuition or abstract conceptual reasoning. That's why Learn Python the Hard Way is targeted at beginners. Page 4 of the Shaw-Hanselman interview transcript discusses direct instruction. http://s3.amazonaws.com/hanselminutes/hanselminutes_0407.pdf http://s3.amazonaws.com/hanselminutes/hanselminutes_0407.pdf Out of curiosity did your SO learn Python and if so what resources worked particularly well?
- brudgers 12y agoScott Hanselman's great podcast interview with Zed Shaw: http://hanselminutes.com/407/learning-code-the-hard-way-with-zed-shaw http://hanselminutes.com/407/learning-code-the-hard-way-with...
- bluerail 12y agoThank you Zed Shaw.. This is an excellent resource that has helped me to become what I am today.. I started learning Python using this book and he really takes time to ensure the readers understand what they are doing. It may be too silly for you programmers, but almost every beginner programmers as me would have definitely cam across this resource. This has helped innumberable and I'm sure it will.. Thanks once again.
- shanecleveland 12y agoOne of the most important challenges I have undertaken in the past several years.
- zedshaw 12y agoYou're welcome. I honestly write the books for people like you, and thankfully the world of programmers and the world of regular people really doesn't intersect much.
- pknerd 12y agoThankyou Sir! I am planning to brush up my SQL knowledge in coming weeks and will read your stuff. Already enjoyed LPTHW
- thebouv 12y agoI have no idea who Zed Shaw is. I've always wanted to know more about Python. Might give it an unbiased read through.
- Johnny_Brahms 12y agoIf you want to see some really nice python, look at his "lamson" project. It's really nice.
- cjf4 12y agoHaving actually used this as a self learning tool, my feelings were mixed. On one hand, I think it's organized and clear. On the other, I found it's drill approach to be ineffective for me. I think reps are really good for something that uses muscle memory, like shooting 3s or dicing an onion. However, I found for learning programming, I got a lot more mileage out of teaching methods that have set up a solvable problem, point you in the right direction, but leave it to me to create a solution.
- snlacks 12y agoI didn't start with Zed's stuff, but I checked it out when I was interested in Python. For someone like me, it would have been really fun when I was less experienced. I would have liked the repetitive challenges while I was doing them, because I would have challenged my self to go through them as fast as a I could and gamify it (though it wouldn't have been called gamification back then). It would have got me to memorize things. His books are different, I appreciate another take on them. I would read and follow along with his books if they fit my needs now. I've recommended him a couple times to people I thought would benefit from that style. As to his personality, I think most people are jerks sometimes, and not jerks at other times. We all have our issues. :) Generally, I feel that all the conversations about it much more harmful to the profession than the original instances being discussed.
- zedshaw 12y agoThat's a good assessment of the books, and one I put into the introduction. It's weird because what is great for a beginner with zero knowledge is incredibly painful for someone who's experienced. I think that's the key with my book's success and also why a lot of professional programmers seem to completely dislike it. It's also why I'm very honest and upfront about this right in the beginning.
- arafa 12y agoI went through this whole class when it was linked here a couple of months back and really enjoyed it. I'm a self-taught programmer that needed updates on some modern concepts and a refresher on some other stuff, plus a bit of help with Python syntax. If you're like me (or a beginner) it's great. Thanks Zed.
- koshak 12y agoPython 2.5.1 Python 2.6.5 no use of context managers when working with files no use of format when working with text formatting and output "Avoid any project that mentions "Python 3"" "Every if-statement must have an else" no list|dict|generator|set comprehensions. no idiomatic hints no gotchas. Definitely a hard way. Having learnt wrong leads to hard learning to do right.
- zedshaw 12y agoThis book is for people who don't know any programming. So let's catalog your claims in that light: 1. "no use of context managers when working with files" - I teach files early on, before they even know how to make a block. After my book they can easily learn this. 2. "no use of format when working with text formatting and output" - Which format? At the time I was writing this there were what seemed like 10 changes to it and how it worked. The % format syntax works all the time, and it's something found everywhere. Learning it is useful, and doesn't prevent them from using format later. 3. "Avoid any project that mentions "Python 3"" - They should, Python 3 is not ready and is simply frustrating. Python 2 is on all of their computers already for many people, so that's the better one for a beginner. Also after learning 2, they can learn 3 if they need, but if they learn 3, they have to learn 2. 3. "Every if-statement must have an else" - This is for training their ability to think of the entire set of possible boolean results in an if-statement. It's also the cause of many logic bugs and you should consider it as a good way to check your own logic constructs. 4. "no list|dict|generator|set comprehensions." - The book is for beginners who can't even figure out how to run a python script on their own. You think they'll get comprehensions? That's insane. Later they can easily learn this, and I think a theme in your comments is that you think once someone reads one book they are done learning, which is a bizarre idea. 5. "no idiomatic hints" - Which idiom would that be? The early Python that's like JavaWithCamelCase or the new Python that's like c_with_underscores? The problem with Python idioms is they warp fairly regularly depending on what's in vogue at the time, so I just teach the simplest thing that seems to be common among all of them. And again, they will whatever "idiom" you think is important later when someone like you who thinks they're important yells at them about it. Brains are not made of stone. 6. "no gotchas." -- The book has loads of gotchas, AND I have videos that go with it where I show people the gotchas, AND there's additional problems for them to solve at the end of every exercise, AND I encourage them to break their scripts to see how Python gives them errors. You would do well to ditch the idea that people cannot relearn things. Maybe this is holding you back as well, and it's simply false. Heroin and smoking are "bad habits". Playing a guitar scale wrong is a "bad habit". Whether you use CamelCase or loads_of_underscores is just easily updated information.
- pknerd 12y agoSorry for being OT but I would request Zedshaw to write next book about Go Language.
- ianamartin 12y agoUmmm, I don't understand all the dislike. For someone with my background, this was absolutely perfect. It's one of the very first things I read when I decided I wanted to learn Python. Fast forward several years, and now writing Python code is what I do for a living. I could not be happier. I was a violinist, and Zed Shaw's way of teaching the basics completely resonated with me. Thank you, Zed.
- dmkmz 12y agoHello Zed. I didn't actually read whole LPTHW, but LCTHW helped me a lot. I recommended LPTHW to some friends of mine, who were interesting in programming but had no experience at all. Few years later and they are doing programming for living. I personally think it's a good source for a newbie to start with. Keep going with your job and thanks.
- deleted 12y ago[deleted]