10 ms·
Show HN: Learn Python the Right Way – free introduction to Python book
- sixhobbits 5y agoHey HN! We posted this before when it was in very early stages. It's still a work in progress, but the website is live and all the chapters are available online or as a PDF download. I've taught a lot of Python and I think this book (adapted from How to Think Like a Computer Scientist") is the best mix of practice and theory and is usually what I recommend to people as a 'fixed syllabus' when they are overwhelmed by all the options.
- rahimnathwani 5y agoSection 17.1 says "This program pops up a window which stays there until we close it" but I don't see any program listing or any link to a program listing.
- sixhobbits 5y agoThanks for catching that! There were some manual steps to convert it from RST to MD and we are still doing a run through to fix everything up (and to make things consistently use Replit - the later chapters still reference a local environment quite a bit). I've added that code snippet in now. Feel free to let me know if you spot anything else :) The site also links to the original which is more battle-tested at this point [0] [0] http://www.openbookproject.net/thinkcs/python/english3e/ http://www.openbookproject.net/thinkcs/python/english3e/
- kleiba 5y agoWas it Zed Shaw who originated the "Learn X the Y way" pattern?
- teach 5y agoProbably. His "Learn Python the Hard Way" was early and influential.
- shanecleveland 5y agoThis had a huge influence on me. I still have projects running on web.py that stemmed from it.
- jakereps 5y agoIt's also fairly controversial within the Python dev community. I read this title as a jab at that one, because it's not recommended to follow a lot of the "Hard Way" patterns and practices. It's been quite a few years since I was working in Python exclusively, so I can't recall specifics to point out.
- Alex3917 5y ago> It's also fairly controversial within the Python dev community. I can't speak to the Python book, but his Unix and SQL books are fantastic.
- maxnoe 5y agoHe was very hostile towards python 3 for very bad reasons. Telling beginners as late as 2017 that "python3 is such a failure it will kill python". That's not controversial, that's just wrong, especially but not only in hindsight.
- pelagicAustral 5y agoI will forever remember what I consider the best marketing tagline in history for selling a coding book "Programming motherfucker, do you speak it?"
- dave84 5y agoI think Zed riffed on the "Learn X the easy way" pattern that I imagine has existed almost as long as books have.
- kej 5y ago"Learn X the Easy Way" goes back decades, especially in foreign language books. "Learn Python the Hard Way" was deliberately inverting that pattern.
- hardwaresofton 5y agoPerhaps a bit rude but one of the best guides I've seen as an introduction to Python: https://python.swaroopch.com/ https://python.swaroopch.com/ Since I lost my link to this I actually stumbled upon this as well -- evidently UMN has a library of open text books: https://open.umn.edu/opentextbooks https://open.umn.edu/opentextbooks
- mdoms 5y agoI have some friends who are interested in programming but not motivated to work through a text book. I got them into Automate the Boring Stuff and actually solving real problems has been much more motivating for them. https://automatetheboringstuff.com/2e/ https://automatetheboringstuff.com/2e/
- bmitc 5y agoI do think it's a bit ironic to have a title "How to Think Like a Computer Scientist" when using a language that explicitly and intentionally ignored some of the best ideas in computer science: lambdas, concurrency, pattern matching, functional programming, etc.
- teach 5y agoPython _absolutely_ has lambdas and functional programming. And I would argue that concurrency, at least, has no business in a textbook for true beginners.
- kwhitefoot 5y ago> concurrency .. has no business in a textbook for .. beginners. Why on earth not? Lots of people begin by wanting to program a simple real time game and concurrency of some kind is absolutely required to do that. Concurrency not being a first class feature of most mainstream programming languages and frameworks and being clunky in most of the rest is one of the biggest failures of language design in my opinion.
- turndown 5y agoThis is the kind of post where you really wonder if programmers even remember what it was like before they started programming. Concurrency is a legitimately difficult concept to understand and use correctly. In addition, I doubt you need concurrency in game design for a beginner project, or if you do, it's totally abstracted away by the game engine you're using to "learn".
- kwhitefoot 5y agoI didn't have a game engine on my Z80 Nascom-2 (1979-ish). I had to deal with concurrency using interrupts and assembler when I wrote a little maze game where the player was pursued by monsters. Until then I had only written a few programs in Basic. And lots of people program Arduinos and similar kit as their first attempt at coding now, are you going to tell them not to use concurrency?
- Freeboots 5y agoNo comment on the content yet, but its refreshing to click 'Download' and actually be given the book, rather than begged for my email.
- sixhobbits 5y agoA few people have said exactly that! We will keep it that way
- mjfl 5y ago"it's refreshing for me to capture the entirety of the value given generously at this page, without even the slightest effort to give something in return". I have nothing to do with the authors of this book/page but this attitude is why I don't do free software.
- macintux 5y agoAs someone said on the earlier thread: "I'd be happy to pay for it, I just don't want to give my email".
- Siira 5y agoThen why didn't they use a simple email masker? Or a throwaway email account.
- smoldesu 5y agoBecause that takes more than one minute, and most curmudgeons like me will leave if something doesn't present some kind of download link immediately.
- bardworx 5y agoOkay, maybe this approach isn’t for everyone but I have 2 email addresses. One, a Gmail that I’ve had forever, is my “public” email that’s just filled with junk. The other is used for stuff like banks, utilities, etc. and I protect it fiercely from spam of any kind. It’s easy to know what to pay attention to that way and made my life more enjoyable, or at least easier to parse.
- tpoacher 5y ago> Use the online IDE Replit instead of showing students how to set up Python Not sure why, but this feels very backwards to me. I mean, I get it. E.g. Overleaf is a much gentler introduction to LaTeX than Miktex/texlive ... but still. Feels like you're crippling the student in advance by limiting their ability for exploration/exploitation.
- rednerrus 5y agoIt seems like understanding how to setup the environment is a key to really understanding Python.
- analog31 5y agoUnfortunately, that's the case. An issue for Python is that there's no the environment, meaning that approaches to setting it up vary in accordance to its anticipated use, local standards, and even personal preference. When all is said and done, the "Python" that I use for scientific programming is a different beast than the "Python" that my office mate uses for deployment on a cloud based server. Of course this is a blessing of Python but an obstacle for teaching a language to beginners, if you're spending a lot of time troubleshooting installations and wondering why a program runs on one computer and not another. It may explain the staying power of Matlab, which all comes from one place and installs the same on everybody's machine. From talking to people who have learned programming recently, almost every course starts with walking the student through a specific, prescribed installation and making sure it works. It suggests a possible opportunity for another book along the lines of: How to install Python, which explains a variety of scenarios, what they are for, how they work, etc. One benefit of a web based IDE is that it works for K-12 students who are on Chromebooks and can't install software. When my son brought home his school issued Chromebook, my first response was: "Great, let's install Python." He gave me a sad look.
- RheingoldRiver 5y agoIf student A spends 1 hour installing Python (with questionable success rate) & setting up an environment (with even more questionable success rate), and student B spends 1 hour actually typing things into replit and getting results, which student do you think is more likely to continue with a lesson plan? Which student has learned more about Python? Which student is better equipped to pursue setting up an environment (maybe on another computer) at some point in the future? Setting up environments is the most frustrating, seemingly pointless task ever to an absolute beginner. Someone who has literally never written a line of code in their life and has 0 experience troubleshooting anything is extremely likely to get 1 step wrong, or worse have one precondition wrong on their machine that breaks the tutorial's steps, and then get stuck in an endless sea of non-functioning, useless applications now stuck on their hard drive & then become completely disillusioned & never start coding. The lack of setup on the student's part is why previously I have always recommended FreeCodeCamp as the single best way to learn programming on the internet to an absolute beginner, but now that this exists with its replit-based approach (and I know about it) I'm gonna take a look at it and potentially start recommending it instead. P.S. how many IDE shortcut keys did you have to customize before you were at all comfortable with using them? And this is Python, so if we're sending them to VSC instead of Pycharm, imo we're doing them a huge disservice*, and Pycharm's default keybinds are particularly egregiously beginner-unfriendly. *IDE wars aside, arguably the real disservice is locking them into one before they have enough knowledge to form their own opinion
- deleted 5y ago[deleted]
- TheHypnotist 5y agoThis seems great but I find that one of the hardest things for a beginner is setting up the environment. A chapter on that would be nice for a beginner. Edit: I guess this would constitute as more of a tutorial of insert IDE here. But even picking one like VS Code would go some distance toward learning the full scope.
- Kinrany 5y agoRepl.it is great for beginners. In the long run I'm afraid books are not a good format for helping with this. Too many individual differences, and too many things change over time.
- __mharrison__ 5y agoIn my beginning Python book, Illustrated Guide to Python 3, I try and make it really easy to just get started with Python. I encourage using IDLE. For beginners it is fine. There are no other installs to worry about and they can focus on learning the language.
- cutler 5y agoI would be wary of promoting Repl.it if you're going to include Vim users. Vim keybindings exist in per-project Settings but don't work. Otherwise, great free books.
- deleted 5y ago[deleted]
- swagtricker 5y agoThis is a great idea, but does need some more hand-holding and fine points. For example, chapter 3 goes into turtle graphics. Great. However, the book doesn't tell students they need to use the Repl.it Python-Turtle repl rather than the standard one they'd been using. Also, the 2nd example in chapter 3 attempts to set the title in the UI: wn.title("Hello, Tess!") This fails in Repl.it's turtle repl environment.
- sixhobbits 5y agoDefinitely! This is the first MVP release of our conversion of the original to Replit and we have done less than the bare minimum so far. We will be updating it chapter by chapter to address these and more! Thanks for the feedback!
- swagtricker 5y agoOne other point of praise for this approach: being able to run in a web browser via Repl.it is a huge win given the combination of the rise of tablets, as well as the popularity of locked down Windows/Chromebook laptops for students. Many students today and more going forward may not have access to a PC/Mac that they could easily install Python on (or convince an adult to do it for them). Repl.it with the turtle graphics works just dandy on the Chrome browser for my 4 year old iPad Air (disclaimer - I'm a Repl.it subscriber).
- Aperocky 5y agoI'm on the fence about this one as it seem to abstract a dangerous level of stuff away.
- smoldesu 5y agoI agree. I used to be a huge fan of Repl, but the limitations start to present themselves pretty early on. My advice is still the same for people who want to code: go on Ebay and buy a used Thinkpad, install Linux on it and write code. By step two, most people can self-educate themselves on where to go next.
- Aperocky 5y agoFunny that is your suggestion, I started (serious) programming by ordering a $200 laptop from Amazon and installing Linux on it. THIS is the exact advice I give to people. It gives me chills how you captured my path to software so succinctly.
- qsort 5y agoStep two is extremely underrated. There's always been a family computer in my home, but I couldn't do whatever I wanted on it. My irremediable descent into nerddom started when I got a cheap netbook. It was an awful machine, but I could freely poke around and learn stuff. If you're just starting, a potato computer that you fully, exclusively own is much better than a great machine that you share with other people. But of course it's a big time investment and not everyone is interested. If you just want to learn the basics of programming, a fully managed environment is also fine. So much is being abstracted by the programming language itself that the underlying stack is almost a detail.
- smoldesu 5y agoI was super enthusiastic about this until I saw that you're doing it all in Repl. Love it or lump it, you're not going to be writing or deploying any practical Python scripts on Repl, and it's a bad idea to market this as any more "correct" than just interpreting the scripts on your own machine: particularly when the latter is almost objectively more educational and useful.
- ajford 5y agoWhat basic concepts (beyond installing and managing Python env) would you learn by using an interpreter installed locally? The point, to me at least, seems to be laying the groundwork for even more learning and experimentation in python, while making it as easy as possible to do so. It also has the benefit that any reader will end up with the same expected environment the guide is written for. I will say that I totally agree that calling it the "right way" is disingenuous at best, and pure marketing fluff at worst.
- kevinlou 5y agoThanks for this! I suddenly have a ton of free time, and I think I'll dive into this.
- Alex3917 5y agoI learned Python on a whim after seeing a Udacity course on Python posted here in 2012. In retrospect, it was a very good life decision. Godspeed.
- bamey 5y ago>Use the online IDE Replit instead of showing students how to set up Python on Windows (a point where many aspiring programmers give up). What a burn.
- usrme 5y agoThanks for the large amount of effort you've put in to this; it really shows! I'm really looking forward to digging in to this, but I just wanted to ask: will there be an option to download an EPUB version as well?
- sixhobbits 5y agoYep - we actually use LeanPub so we have ePub and mobi versions too. The only reason they are not linked yet is it takes a while to build them all, and we are updating quite often still for now. Here's a link in the meantime if you need https://i.ritzastatic.com/learn-python-the-right-way/learn-python-the-right-way.epub https://i.ritzastatic.com/learn-python-the-right-way/learn-p...
- buggythebug 5y agoAs a "non tech" guy - I have tried learning programming since age 14 with no success. My biggest issue with any of these programs in they teach you some tools, ex. if statements, loops, etcc... then expect you to know how to build a house(program) Make me a bunch of different, simple houses first - then show me exactly how they were built - then MAYBE i'll learn. This goes especially goes for building websites.