Monday, February 13, 2012

Python is the New BASIC

(How’s that for a deliberately provocative title?)

Actually, in spite of everything your first impression is telling you, it’s intended as a compliment. Perhaps if I amend it a little, my intent will become clear:

“Python is both the new BASIC and the new Turbo Pascal.”

What I mean is this:

1) Python is freely available on all major computing platforms. Almost anybody with a computer can have access to Python. People working on the .NET and Java platforms also have the option of IronPython and Jython, respectively.

2) Python is accessible to beginners. A non-programmer can begin using Python and can do some interesting things without much fuss, day one, hour one. In large part this is because Python removes much of the clutter that it takes to get programs working in other languages. A text file and few lines of code, and you’ve got a Python program.

3) Python is accessible to young people. This includes the various Python tutorials aimed specifically at young people. PyGame, in particular, makes it simple for kids to get started doing all sorts of fun and interesting things.

4) Python doesn’t make you wait around, for results. You write a program and run it, no separate compilation phase. This is critical to keeping small programming tasks fun and useful. And although Python is not C, it is pretty darn fast when it runs, as well.

5) Python is handy for scientists and engineers. It was common “back in the day,” for scientists and engineers to use built-in line-number BASIC as a kind of “super programmable calculator.” Python does the same thing; it doesn’t punish you with all the scaffolding required by a large, structured program for simple cases where you don’t need it.

6) However, like Turbo Pascal, Python makes more advanced programing idioms available when you need them. Beginners can start simple and work their way towards more sophisticated concepts. Programs can start as linear test code and be refactored into more complex structures.

7) Also like Turbo Pascal, Python incorporates the best computer science that can be made easy to use. Python doesn’t push the state of the art for all computer science, but what it includes, it includes in a straightforward, “Pythonic” way.

And here’s one way Python is unlike BASIC:

1) The Python ecosystem contains a huge number of excellent libraries and other tools. So much so, in fact, that it has led to the description of Python as “a collection of libraries that just happens to be associated with a programming language.” In large part, this results from the way Python’s simplicity and fun encourages domain experts to produce such libraries.

There are a lot of other good and bad things about Python, but that’s how I can say “Python is the new BASIC,” and mean it as a compliment.



Rhoberta said...


Al Sweigart said...

I completely agree (in fact, I wrote a blog post with this exact title as well: )

You touch on some different points though. Thanks for writing!

TechNeilogy said...

First off, thanks for the comment! Even though, as you did, I meant the comparison as a compliment I was still worried people might take it the wrong way.

(p.s. My niece is learning to program and is an admirer of your books.)

Anonymous said...

This is a LIE. BASIC IS STILL the best language. Modern BASICs can do ANYTHING that any other language can do, that is languages like C, C++, Java or Python.

Here is a list of some modern BASIC languages:
Visual BASIC, FreeBASIC, Power BASIC, Real BASIC, Blitz BASIC, Dark BASIC, Thin BASIC

These are all greatly enhanced supersets of the BASICs of the 1980s to which all of the fear mongers against BASIC refer to . All of these are fantastic to program in and some of them have great libraries that allow complete manipulation of the development hardware just like C. Sure a couple of them may not be object oriented, but fuck object orientation, that's the quickest way to not learn programming. Procedural programming is still the best for single to small programming groups. Objects are mostly beneficial for GUI and graphical manipulations, everything else can still be done easily and more simply using records, user types and arrays.
With Python, ifs absolutely stupid to depend on invisible space as block delimiters.

Python if block:
IF condition:
do something
<-- this space is the end of the block
other code....

BASIC if then block:
IF condition THEN
do something
END IF <-- End of block clearly marked

other code....

What a stupid fool that Guido is. So many people have had the extra burden of tracking down invisible space delimiters when transferring their programs to another development PC, its crazy. Also, there are a lot of broken programs going from Python version 2.7 to 3, so that if you hoped to copy some of your code written in 2.6-2.7 and be interpreted by version 3.0>, there was a good chance it wouldn't work.

Python 2.7 Print is a statement
print "Hello World"

Python 3.0> Print suddenly is a function
print("Hello World")

NO, Python is NOT the new BASIC,

TechNeilogy said...

Thanks for the perspective. I can't say I agree with everything in it, but BASIC was my first programming language (lo! these many years ago) and I do respect where I came from.