Live data from Hacker News

Advice on learning Python efficiently

simplydjango.com

71–75 of 75 posts

Re: Advice on learning Python efficiently

#71

Pretty good advice, along with some good pointers about what NOT to do when learning a languages (ex. reading some instructional book cover-to-cover, forgetting most of the stuff along the way). I often suggest the read-a-chapter-write-a-program-based-on-it route, just to get the practice that is really important, and to solidify some intuition as to what the machine (whether interpreter or bare metal) is doing, and…

I get so frustrated with picking up a new language because they all seem to either be "from scratch, here is how to add two numbers" or cookbooks that assume too much knowledge. the learnxinyminutes stuff is sometimes good. It'd be nice if there was a resource that taught languages from the perspective of already knowing another (any) language in that same family. Show me definitions, modules, packages, namespacing,…

I agree with your gripes here -- absolutely agree there are a lot of languages that get it wrong.

I think there are some books that really get it right though, that show you how to do stuff, but also try to get out of your way. Some examples (in order of adherence to this point, to the best of my ability):

- Practical Common Lisp

- Learn You a Haskell For Great Good

- Clojure For The Brave and True

Re: Advice on learning Python efficiently

#72

Earlier quoted context omitted.

I read c# spec when it was in beta, going fast through it, skimming less informative parts, taking quick notes as bullet points in form of single statement or question. It was one of the best experiences, it put me in flow mode and I learned a lot in very short time. I used c# later professionally and never had problems. Great thing about language specs is that is very precise, without mistakes. The art is to read+sk…

> Great thing about language specs is that is very precise, without mistakes. I'd also add "concise" to the list of required traits for a good language spec. If you don't believe me that's important, go check out the C++ specification. IIRC it contains some 50 pages of rules on how to choose implementations of an overloaded function.

Was this not a direct (possibly knee-jerk) reaction to the ease with which you could shoot yourself in the foot, and undefined behavior C allows?

Re: Advice on learning Python efficiently

#73

Pretty good advice, along with some good pointers about what NOT to do when learning a languages (ex. reading some instructional book cover-to-cover, forgetting most of the stuff along the way). I often suggest the read-a-chapter-write-a-program-based-on-it route, just to get the practice that is really important, and to solidify some intuition as to what the machine (whether interpreter or bare metal) is doing, and…

> I often suggest the read-a-chapter-write-a-program-based-on-it route Learning Perl (the llama book) was great for that. At first, I would think that I understood just from reading the chapter, but doing the exercises at the end of each chapter made me actually learn it.

Absolutely agree! In a previous life, I was working at a company where perl was just about the most recent scripting language they were using (for better or for worse), and that book was an absolute godsend. Reading through Chapter 8 around was all I needed to be productive, and I've recommended the book ever since (especially while I was at that job)

Re: Advice on learning Python efficiently

#74
post #40

Earlier quoted context omitted.

>By doing python projects first you familiarize with it and then if you are still on - you should read zen of python, pep8, etc.. Would you mind recommending some projects for a python beginner?

I find scratching one's own itches is always the best way to learn a new language. Solve a problem that you have.

Problems are not all the same: choose one that stresses and challenges the language, to gain confidence in its strengths and practical expertise.

For example, I once tried to learn Haskell and I started from little exercises (https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems)... I got familiar with syntax and basic concepts, but I was dissatisfied both with the easy, abstract questions and with the simplistic, inefficient answers using basic standard library features that are more or less the same in any language. What was "real" Haskell code like? I expected dealing with serious libraries, memory management etc. would be uglier, more difficult and more cumbersome than exceptionally terse toy examples.

So I attempted something not merely useful and small, but with a well defined practical objective, depending on external standards, requiring production quality libraries and with performance challenges: converting the metadata dump from MAME (a nearly 200MB XML file) into an easy to use SQLite database.

The task was a good test of programming language productivity because, having already used ElementTree and APSW I was sure I could write it in Python quite easily. (And I did; a complete Python implementation, able to roundtrip data back to the XML format for testing purposes, took me less time than an aborted Haskell attempt that could parse a dumb document tree using a ridiculous amount of memory.)

This project allowed me to discover many things about Haskell that are not found in enthusiast-written tutorials: the mess of incompatible and undocumented libraries, the impracticality of basic language design decisions (text handling, lack of namespaces leading to name conflicts, etc.) and my profound disgust for the commonplace syntactic tricks.

Of course, a similar challenge for Python is likely to have a better outcome: learning the difference between good and really good libraries, finding a use for many language features, remembering useful idioms nd design patterns, etc.

Re: Advice on learning Python efficiently

#75

Pretty good advice, along with some good pointers about what NOT to do when learning a languages (ex. reading some instructional book cover-to-cover, forgetting most of the stuff along the way). I often suggest the read-a-chapter-write-a-program-based-on-it route, just to get the practice that is really important, and to solidify some intuition as to what the machine (whether interpreter or bare metal) is doing, and…

> I often suggest the read-a-chapter-write-a-program-based-on-it route Learning Perl (the llama book) was great for that. At first, I would think that I understood just from reading the chapter, but doing the exercises at the end of each chapter made me actually learn it.

Allen Downey's Think Python is that book for Python, though focused more on teaching good programming habits than scripting.
Post reply on HN