Live data from Hacker News

Python is the new BASIC

coffeeghost.net

111–120 of 137 posts

Re: Python is the new BASIC

#111
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…

IF you are going to use needless classes to do Java-esque hello world in Python, a shorter form that is equivalent to the Java is:

  class Hello(object):
      @staticmethod 
      def main(): 
          print "Hello World!"

  if __name__ == "__main__":
      Hello.main()

Your version:

(1) Unnecessarily uses @classmethod instead of @staticmethod, necessitating an argument to main(). @classmethod and @staticmethod in Python are both related to Java static methods, but @staticmethod is the closest analog for Java static methods that do not depend on static member data. Just doing a one-to-one substitution of Java static to Python @classmethod indicates a lack of understanding.

(2) Doesn't actually call Hello.main() the way the python runtime does, and instead reproduces its function in the if __name__ == "__main__" block.

> Based on my experience, there's a lot people learning python who spend a lot of time at the stage where they "just don't get OO", and my opinion is that the reason is the language is bad at teaching them.

Lots of people learning Java, IME, just don't get OO for a long time, too. Obviously, they have to produce a structure with classes and methods in order to produce anything in Java, but having to use the superficial structure of OO and getting OO aren't the same thing. (If anything, being forced to use its structure for everything impairs understanding of what it is for and how to use it appropriately.)

Re: Python is the new BASIC

#112

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...

> If you learn programming with Python, you have to relearn it again to use any other common language, Java, C#, JavaScript etc...

You always have to learn some new things which each language. Doesn't really stop Python from being a good beginners language.

Re: Python is the new BASIC

#113

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…

turtle wasn't BASIC... turtle was Logo! my first programming language, approx age 9 on the BBC Micro at school :)

I believe my first exposure to Turtle was via a Logo cartridge for the C64.

Re: Python is the new BASIC

#114

Yesterday I had to explain to my 9-year-old daughter that the bug in her Python script was due to the fact that she indented with a tab and not four spaces. Trying to publish her program so that her friends could use it was a nightmare (it's a console app). It's 2015 and we have the brightest minds working on this stuff and it's all shit.

it's 2015 and you're still using the wrong editor

That there are right and wrong editors for Python is exactly the point. A 9-year-old could understand BASIC 30 years ago without having to worry about choosing the "right" editor to handle different types of blank space.

Re: Python is the new BASIC

#115
post #68
post #33

Earlier quoted context omitted.

Probably the best point here by far. I didn't start learning to program because I wanted to program, I learned to program because I saw a file called GORILLA.BAS in one of the folders on my MS-DOS machine. Once I figured out I could open it in QBASIC and just press F5.... that was it... I would be a programmer for my next 20+ years and counting. EDIT: I would also like to point out how important the QBASIC IDE was as…

My experience almost exactly mirrors yours. When I was in grade school, there was a shared computer in the hallway outside the eighth-grade classroom, and if the teachers trusted you enough, you could stay in and use it instead of going outside for recess. A few buddies and I would congregate around the PC and play Gorillas. And once we figured out how to edit the source code and do weird things with gravity, or caus…

I recall a friend doing something similar with mobs for Quake 1. The game used its own dialect of C, iirc. And it was possible to decompile the relevant files. So after some time he started modifying mods.

That Quake 2 and later required Visual-C++ and such kinda took the spark out of the creative mods, as the entry price became too high.

For instance Quake 1 had a "flight sim" of sorts that was basically done by one guy using Quake-C and some simple, freeware, modeling tools.

There was an attempt at making a successor for it in Quake 2, but even with a larger team etc it basically ran out of steam thanks to the complexities involved etc.

Re: Python is the new BASIC

#116

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…

Well well, thats nifty. I recall playing with something similar on a old school computer using basics.

BTW, a team at Intel put Python into GRUB recently. And IMO they produced something that strongly reminded me of firing up something akin to the C64 and be greeted with a basic prompt.

Also, i swear i recently read about someone making a python enabled shell. Meaning that you could mix shell commands and python code on the same input. Had some small issues where python syntax overlapped with command switches or something.

Re: Python is the new BASIC

#117

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…

> Python, fwiw, is a better BASIC. The justifications you give for that make it seem like JavaScript is the new BASIC while Python is a better Logo (less ubiquitous language that is structurally better for pedagogy, though disadvantaged simply by being less ubiquitous.) > Windows is the place where it hurts. And still the dominant desktop platform. Which would be less important, as mobile eclipses desktop, if mobile…

Frankly i fear that the tech world is getting less and less tinker friendly decade by decade. At least in the case of off the shelf products.

Re: Python is the new BASIC

#118
post #100
post #82

Earlier quoted context omitted.

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.

All is needed is to have editor that can show white spaces (i.e. show tabs differently than spaces, after all those are two different characters). With that the whole issue with tabs and spaces no longer exists. BTW if you are copying snippets of code from website "as is" in any language you will have to reformat it to fit your structure. Also if you copy code so often that this is becoming an issue I'm not sure I wo…

> Also if you copy code so often that this is becoming an issue I'm not sure I would want someone like that working for me.

This seems like a cruel comment in a thread specifically talking about a 9-year-old learning her first language.

Re: Python is the new BASIC

#119

Earlier quoted context omitted.

The fact that PHP is hated by anyone who learned PHP and moved onto other, ostensibly better things is the reason why all the hate exists. Given any programming task, you're just going to end up with better code in pretty much any other language, especially a functional one.

> Given any programming task, you're just going to end up with better code in pretty much any other language, especially a functional one. This is the exact bull * that good hearted Haskell and Lisp guys have to face and fix because of arrogant people like you. First of all, a good PHP programmer is a good programmer. End of story. You can write crystal clear code in PHP that anyone who started with C (how many I won…

> because of arrogant people like you

> you are entitled to spew crap like that since you are the holder of truth?

We ban users who address other users repeatedly like this, so please don't do it again on HN. Comments here must be civil and substantive.

https://news.ycombinator.com/newsguidelines.html

Re: Python is the new BASIC

#120

Earlier quoted context omitted.

> Given any programming task, you're just going to end up with better code in pretty much any other language, especially a functional one. This is the exact bull * that good hearted Haskell and Lisp guys have to face and fix because of arrogant people like you. First of all, a good PHP programmer is a good programmer. End of story. You can write crystal clear code in PHP that anyone who started with C (how many I won…

> This is the exact bull* that good hearted Haskell and Lisp guys have to face and fix because of arrogant people like you. No. It is not. It takes a lot more effort to produce the code of same quality in php. For one thin, you have to consider that one has to keep and endless list of gotchas and edge cases (yes, all languages have these, but the list is nowhere near as long as it is in php) in mind when writing any…

Isn't the word 'array' quite obvious that it will create an array? Since PHP 5.4 you actually have the shorthand "[]" version available but it is still obvious to anyone who is using PHP or JavaScript (though JS arrays aren't hash maps like PHP's -- you need an object for that).

But I agree, it's crystal clear for anyone with a minor PHP knowledge. For the rest it's just "clear". (It will still work calling $a['1'] with the quotes so what exactly is the issue? If you mean the drawbacks of type coercion not sure if this example is the best one.)

Post reply on HN