News for hackers. Stuff that matters.
Re:Ask HN: How should I teach code to kids? by Eridrus on Saturday February 18, 2017 @01:00PM (#13675802)
Why Python rather than JavaScript?
Re:Ask HN: How should I teach code to kids? by beojan on Saturday February 18, 2017 @01:23PM (#13675917)
The real question is "why JavaScript rather than Python?" The only reason JavaScript is so popular is that it runs in the browser. JavaScript is otherwise a pretty poor language, and certainly much harder to learn than Python.
Re:Ask HN: How should I teach code to kids? by sotojuan on Saturday February 18, 2017 @04:38PM (#13676838)
JS is a pretty bad first language to learn—too many quirks and random syntax in the last few years.

Python is dead simple—I recently had to take on a project written in it having never programmed in Python before and I essentially did not have to learn it to get the feature done.

Re:Ask HN: How should I teach code to kids? by darpa_escapee on Saturday February 18, 2017 @06:27PM (#13677267)
I had a similar experience with JavaScript, assuming you make _extensive_ use of ES2017 syntax and features. It's actually very nice, provided you have a compatible browser, but there's a long way to go still.
Re:Ask HN: How should I teach code to kids? by wwweston on Saturday February 18, 2017 @07:04PM (#13677396)
Having used both to teach beginners, I can assure you that your categorical statements are false.

I might give Python an edge for a number of reasons (a shell is a simpler environment than a browser in a number of ways, some of the language features are cleaner), but to say that it's much harder doesn't bear out with my experience. Capable first-timers become productive at about the same rate.

I've found it's mostly experienced developers who trip over JavaScript, because they're carrying a set of expectations and are weirded out when it does something different. Turns out principle of least surprise means different things depending on people's backgrounds.

Feel free to choose to start someone with Python if you prefer it, or if they're likely to want to work in a domain where it makes sense (say, data science), but it's probably not going to change your learn-to-code outcomes much.

Re:Ask HN: How should I teach code to kids? by mixmastamyk on Saturday February 18, 2017 @08:22PM (#13677675)
That ES6 was created, to substantially redesign the language says otherwise.
Re:Ask HN: How should I teach code to kids? by Eridrus on Saturday February 18, 2017 @01:29PM (#13675945)
Running in the browser and having pretty good debugging tools seems pretty useful to me.
Re:Ask HN: How should I teach code to kids? by darpa_escapee on Saturday February 18, 2017 @02:57PM (#13676387)
Compared to other languages and environments, debugging JavaScript can be difficult if you don't have a good idea of what's going on behind the scenes in specific browser versions, the DOM and JavaScript VM. Throw callbacks, Promises, etc into the mix and things get confusing pretty fast.

Comparatively, other languages, like Python, will throw sane exceptions and a meaningful stack trace when something goes wrong.

Re:Ask HN: How should I teach code to kids? by jventura on Saturday February 18, 2017 @01:39PM (#13676000)
Maybe brython can help with that!

https://brython.info/

Re:Ask HN: How should I teach code to kids? by gtycomb on Saturday February 18, 2017 @03:29PM (#13676521)
I helped an 8 year old get started in Python. It was an almost effortless process once we started with Python's Turtle Graphics. He started "innovating" himself when he saw what he could do with loops etc and draw with the Turtle. I initially tried Javascript but I couldn't think of an easy way to get him to the level of Python's Turtle animations as quickly. Python seemed more packaged and modular this way.
Re:Ask HN: How should I teach code to kids? by josephorjoe on Saturday February 18, 2017 @02:49PM (#13676355)
The syntax of Python is sane, which can't really be said of JavaScript.