Live data from Hacker News

Advice on learning Python efficiently

simplydjango.com

61–70 of 75 posts

Re: Advice on learning Python efficiently

#62

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.

Re: Advice on learning Python efficiently

#63

Earlier quoted context omitted.

What do you mean by the offside rule in this case? I presume you don't mean that Pyret can't shoot if it got the ball when it was behind all the other language's defenders.

Only if the Pyret was already in an offside position when the ball was last played by a team mate and it was not a goal kick, throw-in, or corner kick and Pyret was involved in active play (receiving the ball, interfering with a defender, or obstructing the goalkeeper's view)...but I digress. Python's use of semantic white space in the form of indentation is sometimes referred to as the 'offside rule'.

Interesting, I have never heard that term used in relation to Python white space. TIL

Re: Advice on learning Python efficiently

#64
post #41

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?

A web search engine.

In which case you may want to follow Udacity Com Sci 101 which includes building a search engine in python. (Free, video based https://www.udacity.com/course/intro-to-computer-science--cs...)

Re: Advice on learning Python efficiently

#65
post #63

Earlier quoted context omitted.

Only if the Pyret was already in an offside position when the ball was last played by a team mate and it was not a goal kick, throw-in, or corner kick and Pyret was involved in active play (receiving the ball, interfering with a defender, or obstructing the goalkeeper's view)...but I digress. Python's use of semantic white space in the form of indentation is sometimes referred to as the 'offside rule'.

Interesting, I have never heard that term used in relation to Python white space. TIL

Apparently, the term goes back 50 years. https://en.wikipedia.org/wiki/Off-side_rule

Re: Advice on learning Python efficiently

#66

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…

Smalltalk was developed that way...

Also, MIT switched from scheme to python.

\tangent I agree with your approach of mixing theory and practice. So what's the best way to learn fluid simulation? It's discouraging spending so long on maths without the gratification of Something Actually Working.

Re: Advice on learning Python efficiently

#67
post #51
post #11

Pyret's syntax looks far more complicated to learn than Python's for a beginner.

I'm curious which parts look (more) complicated to you. For some perspective, when teaching Pyret to total beginners, we start with arithmetic and calls to library functions, then build up to function definitions and examples. At that point, there's just a handful of syntactic constructs to consider, and they are nearly identical to Python. Things like "data" and "cases" don't come till later, and do come with more o…

I noted the in first example in the linked into - Python:

    def square(n):
      return n * n
Pyret:

    fun square(n :: Number) -> Number:
      n * n
    end
there's extra stuff. It also kind of loses the elegance of Python reading close to normal language - if you don't know programing but can do math you'd figure the first was define a function that gives a square but be confused what (n :: Number) -> Number: was about.

Re: Advice on learning Python efficiently

#68
This is great post and the observation is quite applicable in pretty much every subject that you want to learn and master, not just Python. In fact, "learning to learn" is perhaps the most important skill we develop as humans and a small improvement in this area translates to order of magnitude improvement in actual learning. In PhD programs they say that getting PhD is not actually about mastering specific subject but rather developing an ability to comb through vast amount of knowledge, assimilate it and synthesize new knowledge. The first two steps is where much of the effort lies which is "learning to learn". The first mistake that most people make in first step is trying to understand everything cover-to-cover of each paper before moving on to next. An experienced person would first try to get big picture (just look at the abstract and results :)) and move on to next one. So you do breadth-first-search followed by some selective depth-first-search and continue back and forth until you build "surface" that represents the usable approximation of state of the vast amount of knowledge. This is many order of magnitude efficient than try to build most of the "surface" from the get go.

Re: Advice on learning Python efficiently

#69
post #67
post #51

Earlier quoted context omitted.

I'm curious which parts look (more) complicated to you. For some perspective, when teaching Pyret to total beginners, we start with arithmetic and calls to library functions, then build up to function definitions and examples. At that point, there's just a handful of syntactic constructs to consider, and they are nearly identical to Python. Things like "data" and "cases" don't come till later, and do come with more o…

I noted the in first example in the linked into - Python: def square(n): return n * n Pyret: fun square(n :: Number) -> Number: n * n end there's extra stuff. It also kind of loses the elegance of Python reading close to normal language - if you don't know programing but can do math you'd figure the first was define a function that gives a square but be confused what (n :: Number) -> Number: was about.

The type annotations are optional, so

    fun square(n):
      n * n
    end
is a closer direct comparison to the Python program, for contexts that don't use annotations.

Re: Advice on learning Python efficiently

#70
Not sure if this will help anyone out there, but learn how to take notes efficiently first. Learning a markup language helps a lot. Be very selective when choosing a book; don't hesitate to throw away a crappy book. Avoid books geared towards getting you "up and running" despite their reviews, they're never worth it. The more sources the better. The only subjects I don't spend time on are non-core API methods; just take note that there is an API and where it is, but referring to the official documentation is better because there's never much you can add of value. Ultimately plan on spending 6-9 months of weekends or 2-3 solid months to learn the bulk of a new language if you're taking notes. If it's your first programming language picking a simple project to do is helpful because otherwise you won't know the "why".
Post reply on HN