Aardvark Daily

New Zealand's longest-running online daily news and commentary publication, now in its 25th year. The opinion pieces presented here are not purported to be fact but reasonable effort is made to ensure accuracy.

Content copyright © 1995 - 2019 to Bruce Simpson (aka Aardvark), the logo was kindly created for Aardvark Daily by the folks at

Please visit the sponsor!
Please visit the sponsor!

Python versus BASIC

14 September 2020

Prepare your inner geek.

Today's column is probably only of interest to the real geeks within the Aardvark community because I'm talking programming languages and what's wrong with at least two of them.

As regular readers will be aware, I've been doing some programming in Python recently -- more out of necessity than desire. This was my first experience with Python and I chose it because it is pretty much the 21st century equivalent of the BASIC interpreters we all used and loved to hate back in the early days of microcomputers.

BASIC became the language de jour for home computer users for quite a few reasons.

It was easy to learn, ubiquitous, fairly standardised and there was a lot of good instructional material available for those who wanted to use it.

Of course Microsoft were hugely instrumental in making BASIC as popular as it was because their version of the language was available on almost every single 8-bit and many early 16-bit systems. Other versions did exist however, and I remember writing a huge amount of code in CBASIC, a pseudo-compiler that had the unusual property of representing numeric values in BCD (binary coded decimal) rather than binary.

BCD was deemed to be very important in accounting applications because it got around the representation errors that might otherwise occur when trying to store fractional values in base-2. If you are unaware of what this means, do some research, it's fascinating!

BASIC also had the advantage that it was interpreted. This meant you could type in short bits of code and run them immediately, without the need to pass them through a compiler and linker.

Now to Python, the modern-day equivalent.

In many ways, Python is light-years ahead of BASIC but in other ways it's just as bad, if not worse.

The biggest weakness of BASIC was that it lacked much in the way of data or code structuring. Perhaps its only concessions to code-structuring were the abilities to define subroutines and very crude functions. From a data-perspective, arrays were about as clever as BASIC got.

Never the less, and despite these impediments to the creation of reliable large-scale projects, I cut my fair share of MBASIC interpreted code, creating a bewildering array of systems that did everything from simple accounting to a full-blown mail-order database system for what was (at the time) NZ's largest mail-order supplier. Those systems ran on TRS80 computers, ranging from the lowly Model 1 through the Model 3 and right up to the much bigger (it had eight-inch floppy drives!) Model 2.

Due to the limitations of just 64K of RAM and the sometimes very slow speed of interpreted BASIC I ended up coding key aspects of most programs in assembler and ran them as machine-code.

Once you got to a certain level of complexity and scale, BASIC just created more problems than it solved -- not the least of which is that because it was interpreted, there was always the risk of an unexpected "Syntax Error" or whatever popping up when an extremely rarely used line of code was called and it contained just such an error.

This was another reason for me opting to use CBASIC later in the process. At least the compiler would catch all the syntax errors before they became an issue weeks or even months further down the track.

The other problem with large interpeted BASIC programs was that of garbage-collection. Once the string pool had become sufficiently fragmented, the program would go to sleep for what sometimes seemed like inordinately long periods of time as the humble Z80 processor struggled to re-arrange data so as to create some contiguous space for variables.

Python's interpeted nature means that it also has the lurking syntax error problems in lines of code that may only be called once in a blue moon, something that would give any programmer sleepless nights in the early days after commissioning a new system.

The reliance on weakly typed variables without predefined length means that eventually garbage collection would also be an issue with Python, however the fact that we're no longer constrained by a wimpy 64K of RAM probably turns this into a non-issue.

What is more concerning though, is the lack of need to define variables before they're used and, as mentioned above, that very weak type-checking. In fact variables are typed through use rather than by definition -- risky stuff!

Fortunately, Python does have the ability to define functions and therefore the evil GOTO has been banished into the history books. However, there is no real ability to create a data-structure, unless you're defining a new class and within that class we still have the lack of type definition.

Exception-handling is a nice addition (the equivalent of ONERROR GOTO in BASIC) and there is some rather poor concession to (pseudo)multi-threading

So, after a month or so of playing with Python I'm firmly of the equivalent that it really doesn't offer a whole lot more than old BASIC did, aside from a little more ability to structure code, some concessions to object-oriented techniques and significantly better performance -- although the latter is probaby more attributable to the speed of the hardware on which it runs.

Perhaps the ultimate proof that "not much has changed" is the fact that the software I've written (for my ADSB drone/aircraft alarm) still required me to delve into a lower-level language for the time-critical parts and where true multi-threading was necessary.

Yes, Python is the new BASIC and I probably won't be using it again, if I can avoid it.

I'd love to hear what readers' experiences with and thoughts of Python are.

What is your preferred language these days -- whether knocking up a few lines of code or embarking on something a little more ambitious?

Please visit the sponsor!
Please visit the sponsor!

Have your say in the Aardvark Forums.

PERMALINK to this column

Rank This Aardvark Page


Change Font

Sci-Tech headlines



The EZ Battery Reconditioning scam

Beware The Alternative Energy Scammers

The Great "Run Your Car On Water" Scam


Recent Columns

Let us see if this works
As regular readers will know, I've had issues with New Zealand's Civil Aviation Authority and the way they enforce part 101 of the Civil Aviation Regulations (CAR)...

What is your B plan?
The world is changing, and perhaps not for the better...

Too horrible to contemplate?
It's hard to believe that the last global conflict was a mere 75 years ago...

The needs of the many
New Zealand has Covid 19 under control...

Too big to care
Bullying is a bad thing...

Is tech a trickle-up benefit
Technology is wonderful...

Our last wisp of privacy to be lost?
Privacy, anyone remember that? ...

Finally... shifted and sorted
What an interesting week I've just endured...

The world is changing fast
It has been very interesting, as well as depressing, to watch the way the world has changed recently...

I am going to bore you
I don't know if it's because nobody is interested or simply because people don't bother to comment but there are two subjects that I regularly write about that generate very little in the way of response...

Cryptocurrency and tax
For as long as there has been trade, there have been currencies...