Python versus BASIC (14 Sep, 2020)

Have your say on today's Aardvark Daily column

Python versus BASIC (14 Sep, 2020)

Postby aardvark_admin » Mon Sep 14, 2020 6:50 am

This column is archived at: https://aardvark.co.nz/daily/2020/0914.shtml

Is Python the new BASIC?

Have you used Python and if so, what do you think?

What are your languages of choice - both for knocking together just a few lines of code or for more ambitious projects?

Do you even cut code any more?
aardvark_admin
Site Admin
 
Posts: 4508
Joined: Wed May 07, 2014 2:10 pm

Re: Python versus BASIC (14 Sep, 2020)

Postby GSVNoFixedAbode » Mon Sep 14, 2020 8:40 am

Just recently started playing with Python (R Pi) and it seems powerful enough for my needs at present (Visual Information board. Ok, scrolling text. Ok ok, so I'm playing with LED strings).

I've delved into C# a bit, but that was before I'd gotten my head fully around OO programming and it seemed rather convoluted. I like Python for its readability if nothing else.
GSVNoFixedAbode
 
Posts: 373
Joined: Thu May 08, 2014 8:53 am

Re: Python versus BASIC (14 Sep, 2020)

Postby dingram17 » Mon Sep 14, 2020 9:58 am

My goto programming language these days is R. It is so much more than "just a stats package" with libraries that do a heap of what I need. Downloading data, XML processing, CSV imports, complex data filtering, map generation etc. Having a nice IDE makes all the difference, and RStudio is very easy to use, and better than the Python options I've found for developing and iterating code changes.

Prior to R the language of choice for me was VB6, and prior to that it was VB4, VB3, VBDOS, QBASIC, GWBASIC, going all the way back to TRS80 Model 1 Basic.

I've used Python for some machine control systems when I needed to send messages over serial (Modbus) or control instruments with SCPI commands (GBIP over TCP socket). It does the job, but it isn't great. Sure beats Forth, which is the poxiest language I've ever used for an embedded system. Was made even worse since the compiler was built into the embedded system and code had to go in via a 9600bps terminal -- no offline compiler.

It would be nice if there was the equivalent of "Option Explicit" for Python to avoid the variable name typo problem. I think there are Lint equivalents for Python, so could probably do a code check before releasing into the wild.
User avatar
dingram17
 
Posts: 30
Joined: Mon May 09, 2016 9:47 am

Re: Python versus BASIC (14 Sep, 2020)

Postby Hiro Protagonist » Mon Sep 14, 2020 10:43 am

aardvark_admin wrote:Have you used Python and if so, what do you think?

What are your languages of choice - both for knocking together just a few lines of code or for more ambitious projects?

I've messed with Python, most often modifying someone else's code that doesn't quite do what I want. The weak typing drives me nuts. The number of times I've had to crawl through code trying to figure out just what this 'thing' is that some function is sending me... not at all helped by the number of Python programmers that seem to think commenting has been outlawed.

For knocking together a few lines of stuff I quite often use bash - it runs on everything I need. More complex stuff I'll usually just do it in C, and for the stuff in the middle there's always this:
Code: Select all
#!/usr/bin/env bash
#if 0
if [ "$0" -nt "$0.bin" ]
then
  CCOPTS="${CCOPTS:--O3}"
  if ! tail -n +2 "$0" | gcc -x c "${CCOPTS}" -o "$0.bin" -
  then
    echo Compile Error on $0
    exit 999
  fi
fi
exec "$0.bin"
#endif

#include <stdio.h>

int
main (int argc, char *argv[])
{
 return printf("hello world!\n");
}
Hiro Protagonist
 
Posts: 124
Joined: Thu May 08, 2014 11:26 am

Re: Python versus BASIC (14 Sep, 2020)

Postby goosemoose » Mon Sep 14, 2020 10:58 am

Python. Love it. Does everything I need and more. Not that I'm developing hardcore stuff. I did use the C++ QT toolkit but nows its there for Python I use it all the time and have written some moderately size applications in it. I do have the odd issue with typing but nothing insurmountable. I also do a bit of PERL, where is text handling and regex's are so much easier than anything else, Python included. For pure performance it's C round here though.
goosemoose
 
Posts: 724
Joined: Thu May 08, 2014 1:05 pm

Re: Python versus BASIC (14 Sep, 2020)

Postby joeseph » Mon Sep 14, 2020 12:37 pm

Hiro Protagonist wrote:not at all helped by the number of Python programmers that seem to think commenting has been outlawed.


good point - although I suspect a lot of that is around self-preservation & job security (or could be just laziness!)
joeseph
 
Posts: 152
Joined: Fri May 09, 2014 2:11 pm


Return to Today's column

Who is online

Users browsing this forum: No registered users and 5 guests