Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I couldn't be more thankful that python was one of my first languages, and this is something that I've passed on to everybody I've ever mentored.

Python is a real language that does real things, but it's also completely approachable to a newbie.

If programming seems hard, then you have a bad teacher that is probably just trying to evangelize their hobby to you.

And god help anybody that tries to start with JavaScript.



I don't get why people hate on starting with JavaScript. Since ES6, JS strikes a really nice balance between practical usage and theoretical value. Like Scheme it's a dynamically typed language focused around a single data structure (list for Scheme, object for JS), with first class functions. Sure, it has weak typing and there's some scoping complexity. But, that's a completely reasonable tradeoff for being one of the most useful languages in the entire world. Not to mention, JS's weird casting issues are not as common as people make them out to be and const/let solves a lot of the scoping problems.


I think JS is a great first language. In my experience as a teacher of programming, most students are not like me. Unlike me, nearly every student of my acquaintance is motivated by making things. It's easier in JS to make things that are visually interesting, that are demoable to your peers and family, that are easy to deploy to a variety of useful environments.

JS is a good starting language, for the typical starting student, because it helps them cultivate their intrinsic motivation.

Less importantly, but still important to me: JS is also a more beautiful language than most mainstream languages, except for the ten or fifteen god-awful warts that it admittedly has, that everyone is disproportionately obsessed with.

(I, unlike most of my students, was interested in computational thinking from the very beginning: iteration, recursion, data types, algorithms, etc, and I was uninterested in actually making things. My first languages were BASIC and Pascal and C, and as far as I can tell, that worked out okay.)


I disagree completely - javascript encourages shitty programming by design and by culture. If you don’t expose the young chances are they won’t get infected.


Because all of those who started on something like C, C++, or Java have way better programming practices? My experience tells me that starting language is literally not a vector in determining how good of a programmer someone is.


I agree. Maybe its the barrier to entry for publishing that has gotten a lot lower and thus pushing down the quality of public code (which is natural). Or maybe im just worried about everything being pushed to the browser.


This is absolutely nonsense. Modern JavaScript is powerful and actually quite elegant. Perhaps stop thinking about the crappy JavaScript people wrote >10 years ago.


Maybe some are. There is however nothing nothing elegant about running 5 massive electron, node etc apps in your browser w. 60% code overlap grinding everything to a halt. Its not so much the language but how its being used.


Because programming should be descriptive to what you want the computer to do, and the way that humans explain things to each other is usually linear.

For instance: brush your teeth, then put on your clothes, then get in the car, then start it.

The "JavaScript" way to do this is that starting your car is somehow nested inside of the brush your teeth event. Everything is a callback of everything else, so trying to explain to your computer what you want it to do ends up as a giant spaghetti mess.

Obviously there is a JavaScript way of thinking that allows you to think of brushing your teeth as a dependency to starting your car, but I don't think that this is how most humans think by default, so it's a terrible way to teach students.

It makes them think that computers are these complicated things that take some immense skill to operate, but they're not anymore. You just need to tell the machine what to do, and good languages like python make that really easy.

At this point in my life, I'm mostly writing C++, JavaScript, and golang, but I'm extremely thankful that I started with python. When I need to bang out a prototype, or test something in code, it is always my go to.


Modern JS fixes this (mostly). Promises and async/await (ES5 and 6) address those issues. What was previously

    function first(cb) {
        console.log('first');
        cb();
    }

    function second() {
        console.log('second');
    }

    first(second);
can now be expressed as

    new Promise().then(console.log('first'))
                 .then(console.log('second');
or

    async function first() {
        console.log('first');
    }
    async function second() {
        console.log('second');
    }
    async () => {
        await first();
        await second();
    }();
depending on exactly what your goals are. The inversion of order ("callback hell") can be avoided if you stick to modern concepts.


Okay, in python this is:

     print "first"
     print "second"
I mean...imagine explaining your example to somebody. That's difficult for some programmers to fully understand.


No. In python(3.7+) this is

    import asyncio

    async def first():
        print("first")

    async def second():
       print("second")

    async def _():
        await first()
        await second()

    asyncio.run(_())
prior to python3.7, python didn't have similarly clean asynchronous programming tools. With python 3.5+, you could use the old event loop syntax [1] to do it, and prior to that, you needed to use `yield` and `yield from` for similar semantics.

If you want synchronous stuff in JS, this suffices:

    console.log('first');
    console.log('second');

EDIT:

The problem that JS had (prior to promises in ES5) was that the only way to do deferred/asynchronous things (like "run this after I get data from a network call") was to provide a callback, something like

    function(resource_url, callback) {
        data = get(resource_url);
        callback(data);
    }
This gets very trick very fast if you want to have chained calls (imagine that `callback` also conditionally requests a resource, and you want to do something with that resource, and based on that you may want to redraw the DOM and then...).

There wasn't a good pattern for describing that in JS. The "common" pattern was to just have callbacks within callbacks, and unlike in python you'd often use anonymous functions, so you end up with nested anonymous functions which inverts the way you think, it's really hard to grok.

Promises and async/await linearize that, but that's a problem that python never really had to address because up until very recently, python didn't get used for async stuff.

[1]: https://docs.python.org/3.6/library/asyncio-task.html#exampl...


Agreed. Building a web app is more "real" to many who are just starting out.


I had not coded in a long time. Not written any type of helloworld.c in years (more than a decade) I've recently updated and wedged in a programming ENV: on the machine I spent most time on these days.

I say wedged because IMHO programming env's are the easiest to setup and maintain in POSIX OS's. This closed source OS I'm most in (because I stream simulations & games on this DAW) is not really suited for it.

One of the 1st languages I installed was python. For me the reason is a nice Raspberry PI I got from a friend of mine, but most of all the accessability of the language on literally all OS's you can throw a stick at.

Another reason is

  python -v -m SimpleHTTPServer 8088
amazing, when you run it in verbose mode


php -S 127.0.0.1:8088 is a good one as well, it helps with debugging PHP quickly (I still am in the boat as PHP being a better lang for handing web stuff)




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: