Live data from Hacker News

Why I push for Python

lorenabarba.com

71–80 of 129 posts

Re: Why I push for Python

#71
post #52

Earlier quoted context omitted.

I think it all depends of your goals, if you learn to cook in order to impress your friends, no you probably don't need chemistry lessons, but if you plan to win 3 Michelin stars for your restaurant, you probably need to. Same for programmation, if you just want to ease your work, compute quickly some math formulas, etc, you can start with Python. But if you plan to write the next big OS, you better start with C...

No, you absolutely don't need to start with C. You need to learn C (or some equivalently low-level language) eventually .

I agree with this. I started with Python, then later learned C. Taking the top down approach has several benefits when learning. You can make programs that actually do things much more rapidly, incentivising continued learning; this can not be emphasized enough. Less time is wasted wrestling with the many subtleties of something like C. Although important, knowing about pointers and memory allocation is unnecessary when trying to get across very basic fundamentals like control flow. Python also acts as a model for good abstractions. If you start out working with Python's list type, lists are already a familiar concept when it comes time to implement a linked list, because you understand how it should* work. By the time the student is ready to learn something like C, they already have a solid grasp on how things are supposed to work, so understanding how they actually work becomes substantially easier.

*CPython's list type is really a dynamic array, and it works better as a stack. However the interface is similar enough to a typical linked list, that it gets the point across.

Re: Why I push for Python

#72
post #66

Earlier quoted context omitted.

JavaScript has numerous caveats and idiosyncrasies that result in strange and unexpected behavior. It's scoping rules are also pretty broken. While Python does have some of its own quirks, they're far fewer in number. There are two that bite people pretty often, using a mutable type as a default function parameter, and accidentally typing a comma after an expression subtly converting it to a tuple.

A lot of the problems with JavaScript aren't "caveats and idiosyncrasies" or "quirks". They're rather horrible and unjustifiable flaws, plain and simple.

I agree, they are horrible flaws. Though to be fair, you have to understand why JavaScript has as many flaws as it does. I believe this is largely due to the context in which it was created. First, it was written in the absolute minimal amount time possible. "If it fits, it ships", really applies here. Second, JavaScript was designed to make sub 200 line scripts that add basic interactivity to web pages, not to make the complex layered applications it's often used for today.

Re: Why I push for Python

#73
post #44

Why do people advocate Python and not a dialect of Lisp for beginners? Are prefix notation and parentheses really that terrible in exchange for a completely unified syntax?

I believe Lisp is a good choice for beginners too, but it's two different approaches. Lisp is interesting for the theory behind it - you can introduce lambda calculus, parsers, AST, stacks while you teach the language, and the student will have a grasp of how the computer understands code. Python is a more hands-on approach - you just teach some syntax that reads like english and the student can put some libraries together and do something meaningful, the barrier is low and you get instant gratification, which is important to keep students motivated.

Re: Why I push for Python

#74

I teach 11 to 18 year olds and I've stopped teaching them Python and started teaching them JavaScript. My main reason for the switch is to overcome the "What's the point of this?" questions that I used to receive. With JavaScript the kids instantly see a result on a platform they're familiar with - a browser. window.alert() is instantly recognisable to them and seems far more relevant than print"" where the output is…

I'm just starting out teaching my daughter (10). Any recommendations on how best to get her started with JS?

Re: Why I push for Python

#75
post #60

If I had to overly generalize, programmers tend to fall into the "builder" and "curiosity" camps. I grew up using a Borland C++ compiler that didn't list which line numbers were missing semi-colons. I didn't mind going over my code to find the missing semi-colon, but plenty of my classmates were frustrated. They weren't interested in how compilers worked, how code was parsed and debugging information was lost in the…

> Nowadays I think Python is the ideal first language followed by C and Haskell. It's starting in the middle, and then moving towards opposite ends of the programming spectrum: systems and functional programming.

I agree. My friend studied CS at UC Berkeley where (at the time?) first semester was Scheme, second semester was assembly language, and then subsequent classwork was usually C++ or Java.

Re: Why I push for Python

#76
post #36

It seems the only argument for pushing Python is that it sidesteps the need to understand fundamental programming concepts. Sure Python is easy to read and easy to write, but that's not really the point. To teach somebody print "hello world" in Python is not really teaching them much at all... Teaching someone the C equivalent would cover functions ("what is 'void main()'?"), entry points and how programs are loaded…

What makes 'void main()' fundamental to programming? And the syntactic sugar of cout and operator overloading? Come on. If there's anything fundamental about programming it's not the particular design choices made in your favorite language. What makes Python good is that it allows one to focus on learning to translate ideas into programs before having to deal with all the other junk that goes into programming in other languages.

Re: Why I push for Python

#77

I teach 11 to 18 year olds and I've stopped teaching them Python and started teaching them JavaScript. My main reason for the switch is to overcome the "What's the point of this?" questions that I used to receive. With JavaScript the kids instantly see a result on a platform they're familiar with - a browser. window.alert() is instantly recognisable to them and seems far more relevant than print"" where the output is…

I'm just starting out teaching my daughter (10). Any recommendations on how best to get her started with JS?

Here's what I'm using with my Year 7s (11yo) at the moment. It still needs lots of work and is not at all a finished project.

http://marcscott.github.io/7-WD-JS/

I'm sure there are better offerings out there though.

Re: Why I push for Python

#78

Python was the first language I learned in college, and I have to agree with the OP's opinion on this. While transitioning to C++ in later courses did involve some pain points, I felt like python was a great way to ease into the programmer mindset and get the basic concepts out of the way before delving into the more low-level stuff like pointers, and later with OOP. Not to mention that Python is becoming the Lingua…

PHP would be even more powerful to you ;)

How would PHP be even more powerful?

Re: Why I push for Python

#79
post #36

It seems the only argument for pushing Python is that it sidesteps the need to understand fundamental programming concepts. Sure Python is easy to read and easy to write, but that's not really the point. To teach somebody print "hello world" in Python is not really teaching them much at all... Teaching someone the C equivalent would cover functions ("what is 'void main()'?"), entry points and how programs are loaded…

I wonder if there are differing schools of thought as to what are the fundamental programming concepts. Is it more fundamental to expose students to, or isolate them from, the innards of the computer, when they are first learning to program? Short of settling that issue, the next best thing might be to expose students to at least a couple of different approaches. Python and C would be my choices. I'd teach C on a microcontroller target.

Some isolation is necessary. I doubt that I could completely explain how either print or printf turns the pixels on and off on the display.

Re: Why I push for Python

#80

I teach 11 to 18 year olds and I've stopped teaching them Python and started teaching them JavaScript. My main reason for the switch is to overcome the "What's the point of this?" questions that I used to receive. With JavaScript the kids instantly see a result on a platform they're familiar with - a browser. window.alert() is instantly recognisable to them and seems far more relevant than print"" where the output is…

I'm just starting out teaching my daughter (10). Any recommendations on how best to get her started with JS?

It's not javascript, but my daughter loves Logo. She's a little younger than 10, so it's still off and on and a lot of parental involvement.
Post reply on HN