Hacker News new | comments | show | ask | jobs | submit login
Learning Python the pragmatic way (jmoz.co.uk)
77 points by jwmoz 1578 days ago | hide | past | web | 28 comments | favorite

Learning Python the Hard Way was perfect for me. I did some procedural programming with Pascal and C in the 1980s, but nothing with programming for the next 20 years. 3 months ago I started learning Django/Python. Python was the easy part as I breezed through exercises 1 through 36 in less than 2 weeks. I agree though that exercise 37 is overwhelming and that's where I stopped learning Python and began building Django apps. I did also have to carefully study OOP.

I fervently wish there were something for Django along the lines of Learn Python the Hard Way. I HAVE been learning by doing projects and every few days I get stuck for hours on something confusing about Django I don't understand. I would love guided exercises - especially on some of the more confusing aspects of Django like the cumbersome HTML template syntax, HTML template inheritance, passing the context around, directory/file structure (and the kinds of issues to expect if your files are not in the right place), customizing forms, etc.

Of course, I understand there are different learning styles. Code Academy is even more pure learning exercises but I found that very frustrating as it keeps saying your correct output is done the wrong way but won't tell you why. Learn Python the Hard Way is in between because you have latitude to implement your own way and gives you creative license on some exercises to do extra if you're interested.

TLDR: Took less than 2 weeks to go from exercises 1 through 36. Taking me months to get up to speed on Django, which has no such exercises.

Using Python for basic coding is one thing. Understanding a web framework is another, it (django at least) requires an understanding of databases, http, html, css and javascript. Each of those could be it's own Learn X the Hard Way.

Learn Python the Hard Way should really be called Learn Programming the Hard Way Using Python. If you're a good enough programmer to make a living programming in PHP you're probably not the target audience for LPTHW. On the other hand I've had success getting people whom wouldn't know where to start, or even what what I meant, if I asked them to write "Hello World" started on Python programming using LPTHW

From the article: "For example, exercise 37: symbol review. There’s nearly 100 different symbols to look at and the exercise suggests “Spend about a week on this, but if you finish faster that’s great.” – too much, too long."

From the exercise itself: "Finally, use each of these in a small Python program, or as many as you can get done. The key here is to find out what the symbol does, make sure you got it right, correct it if you do not, then use it to lock it in."

The conclusion in the article: "For me, the easiest and most pragmatic way to learn Python is not by reading through pages of reference documentation and syntax, but to just start coding."


Nice "gotcha!" but it still doesn't take away from the author's point which is that diving in and looking up what you need to know to get a task done is sometimes preferable to going through complete exercises like those in LPTHW. For total beginners the exercises may work but if you're an experienced programmer what you're really looking for is just how Python does things. You already know how to program but you just don't know how a new language implements the concepts you already know. So I don't see anything wrong with that part of the article. The guy's not lobbying for something or talking about anything controversial at all. He's just talking about how he learned to program in Python coming from PHP. No need to try to "catch" him.

If you're an experienced programmer, LPTHW is not for you. That much should be evident from the very first sentence: "This simple book is meant to get you started in programming."


Thank you.

Isn't that the entire point of "The Hard way" approach - don't just read, but start writing code to figure things out.

I think the author means that he prefers to learn by writing something meaningful, rather than doing coding exercises like "use each of these in a small Python program". I agree with him - I'm too impatient for something like LPTHW.

If you are already a programmer, you should know most of of the operators and keywords except for a few Python-isms.

Quote: "What's also important is to find out what you do not know so you can fix it later."

Totally second you on _start coding_ approach. If you know any of the language then it's not difficult to start a new within hours. In presence of forums like Stackoverflow it hardly takes time to write your first HELLO WORLD kind of stuff.

Recently I took initial steps in world of Python by accepting a freelance project in which I had to port a Coldfusion based Middle Tier into Python. I worked on CFM 12 years back so that was the only help for me otherwise for last few years I have been working on Java and PHP.

Needless to say, my client loved my work

And I'm guessing you loved Python? I'm so bored of PHP - and am finding Python really great to work with.

Damn right.

My core intention with this was to show a basic stack and examples for newcomers. The surplus references to 'just start coding' etc is an attempt to reference the recognisable title :)

There are different types of "learning"-scouring SO, rote repetition, understanding best practices, understand why best practices are such, and reading the underlying code.

For professionals who value their time I would posit that "just coding" using SO is not the most effective way to learn a language. It might help you in a pinch, so you can copy and paste a few lines of code, but may not explain why the code should behave that way. (Albeit there is quite a continuum of response types on SO).

Don't worry, I'd never use SO as a copy-paste job.

Great article. I’m the same way, don’t have the discipline to sit through something like LPTHW. For beginners I’ll suggest hosting on Heroku. They have great guides on their support site and you won’t have to think about all that process management. They’re still free if your project only needs one worker (low traffic, no task queues or such).

Also check out Google's appengine and AWS, both have free tiers. I think AWS has support for Flask. GAE was quite steep a learning curve but I managed to get a Django testapp running on it. I want to try AWS next.

Specifically, AWS Beanstalk.

yeah they recently got all the requirements.txt stuff right - approved!

Going from PHP to Python is great. Python feels like a huge breath of fresh air, yet it is similar enough in some respects that it isn't a huge change in the way you think.

1. "Your previous language will help you." assumes you knew a language previously.

2. Be careful, as the old adage goes; you can write FORTRAN in any language.

Good point, thanks.

I'm pleasant to see fellow devs switching from PHP to Python. I did the same thing about half year ago. :)

great one !!!

Thanks, just trying to share what I've learnt as a newcomer - I know I'm terrible at writing!

Thanks, I've been dabbling with Python for a while and I thought your article was informative and pretty well written!

Keep it up :-)

I completely agree with your "just start coding" approach. When I decided I wanted to learn Python I used it to scratch my own itch (nerd alert: I wrote a MSPA update notifier for linux). In the process I learned some basic python (including how awesome the docs are), about parsing XML in python, about the libnotify system and how to read the file system.

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