Live data from Hacker News

Python is the new BASIC

coffeeghost.net

81–90 of 137 posts

Re: Python is the new BASIC

#81

Nope, sorry. Python is an easy, good language. Basic was not popular because it was easy, or even good, it was popular because it was everywhere. JavaScript, for all its warts and foibles, is the new basic. It's easy enough, and it's everywhere.

Python, fwiw, is a better BASIC. It includes a built-in Turtle graphics system and a decent IDE. You can teach loops and draw graphics in just a few lines of code: import turtle turtle.setup() turtle.forward(100) turtle.turn(90) turtle.forward(100) And so on. That initial experience has been one of the easiest to teach kids outside of a visual environment like Scratch. Some friends of mine have tried teaching Javascr…

> It includes a built-in Turtle graphics system and a decent IDE. You can teach loops and draw graphics in just a few lines of code:

What! I've been looking for a nice easy to use turtle program for ages and it's been right in front of me the whole time!

Thank you for this.

Re: Python is the new BASIC

#82
post #75

Earlier quoted context omitted.

What? He doesn't even mention anywhere in his comment what editor he is using

And he didn't need to, any editor that mixes space indents with tabs is the wrong editor.

Untrue - start editing a file in a tabs editor, download a snippet from the internet that has spaces in it, and voila - you've screwed up your file.

And this happens all the time to professional developers, much less 9-year-old beginners.

Re: Python is the new BASIC

#83

Very true. It probably can't happen for various reasons, but I would love if windows just folded python 3.2 in as part of the default install. Python certainly feels, to me, like the most similar language to the old QBasic. Simple syntax, with advanced features that you can use, or not use, pretty robust standard library, not great, but usable IDE built-in (I assume IDLE still comes in the install?) One of the really…

Maybe Python has all these qualities, but it is - different -. If you learn programming with Python, you have to relearn it again to use any other common language, Java, C#, JavaScript etc...

Javascript has a lot of similarities to Python, actually. Why would you consider it so different?

I'd consider Javascript closer to Python than to C/C++/Java, for example.

Re: Python is the new BASIC

#84
It's true that Java needs boilerplate code even for "hello world" but this isn't a real issue and the IDE produces it for you. The general need for more boilerplate is a slight nuisance, which makes languages like Python and Ruby slightly better for getting started. (Though Java's ability to catch compile errors is helpful for beginners... )

Re: Python is the new BASIC

#85
post #20

Earlier quoted context omitted.

Agreed. Callback hell in JavaScript is reminiscent of the GOTO-hell we used to suffer as BASIC programs grew larger. Like you said, with all its problems it was still ubiquitous and practical. So is JavaScript.

console.log("Hello") is not more complicated than print("Hello"). For the callbacks it is actually possible to not use them. See how to: http://www.xul.fr/javascript/no-callback.php (and it is even very simple). That is just a matter of style.

(Is that a joke? Am I falling for that rule that says that jokes on the Internet can not be recognized?)

Yes, you can use promises instead of callbacks, and get in promise-hell instead of callback-hell. It's indeed a matter of style.

Re: Python is the new BASIC

#87
Anecdotally, I recently went back and did some QuickBasic 4.5 programming, and was surprised how decent the experience actually was. I was on a retro kick, and was working backward/up to to doing some IBM PCjr hardware cartridge programming/ROM design. I still have a stack of old programming books from the mid 80's and early 90's and it was great to dust them off and re-read them with a fresh/older set of eyes.

I ended up doing some simple graphics programming on an old 386sx. Using QB for high-level code, and interfacting with some ASM for lower level graphics and data processing, it was actually quite pleasant.

But then, the reference PCjr that I was targeting/experimenting on finally gave up the ghost and died, and I lost interest in hunting down a new one... Poor little guy.

What I took away from the experience is while the tools were more primitive, it wasn't the languages that sucked when I was learning to program in the mid 80's and early 90's as a kid; it was me. I sucked at programming.

Re: Python is the new BASIC

#88

Earlier quoted context omitted.

Python, fwiw, is a better BASIC. It includes a built-in Turtle graphics system and a decent IDE. You can teach loops and draw graphics in just a few lines of code: import turtle turtle.setup() turtle.forward(100) turtle.turn(90) turtle.forward(100) And so on. That initial experience has been one of the easiest to teach kids outside of a visual environment like Scratch. Some friends of mine have tried teaching Javascr…

Nice, turtle is awesome. BTW .turn() seems to be left() or right()

Right, sorry. Off the top of my head.

Re: Python is the new BASIC

#89
post #22

python's problem is that while it goes the distance to make the simplest possible program as simple as possible, simplicity bleeds off very quickly as you add functionality. The shortest well behaved program, for example, looks like this: if __name__ == "__main__": print "Hello World!" and the shortest program that is strictly equivalent to the java program is closer to this: class Hello(object): @classmethod def mai…

Why is this being downvoted? Classes might not be what everybody needs but this pretending that hello world can be written in 1 line is just inviting people to write sloppy code, false advertising is what it is.

In my experience namespace pollution because things are written outside a function is a very common cause of bugs and maintenance problems in production python code. People coming from C/Java/similar think that "if" has scope but it doesn't, only functions do. If i see "main()-code" outside a function during a code review i immediately disregard that whole script.

Any program that actually does something, except just printing hello world, would more likely look like this:

    import sys
    def main(args):    
        function_local_variable = "yay"
        print("hello world")

    if __name__ == "__main__"
        pollute_global_namespace = "yes"
        main(sys.argv)
Short of the braces and the variables i added for clarity it actually has more lines than the java-version.

Re: Python is the new BASIC

#90

Earlier quoted context omitted.

This is the one lesson of PHP that seems to be ignored by a lot (most?) new languages. If you want your language to be popular with beginning web programmers, then provide system administrators with a dead simple way to install it. Add package, done. Then make sure it doesn't cause too much trouble or at least upgrades easily. If it takes almost no effort to install your language and any modules that users might need…

It's really only "easy" if you are using mod_php. If you are using PHP-FPM, FastCGI, etc, as most people do who run production PHP, then things get about as complicated as using uWSGI, mod_wsgi, etc with Python. On that note though, getting mod_wsgi up and running with Apache is really quite simple.

Getting mod_wsgi to run is really easy.

Adapting your wsgi script for "what? is it in a virtual env? Where? What version of Python is running on this server?" and other similar problems is not so easy.

But yes, it's a matter of an hour or two for a complete newby to complete it. It completely disappears when compared to the time it takes to develop the site, but lots and lots of people consider it the most important aspect of a platform, because it comes first.

Post reply on HN