Python is the best beginner language as of 2022

In short:

  • It's useful commercially once you have learned it.
  • It is easy to get started, no IDE required.
  • It is extremely popular and easy to get help with.

Python is useful commercially

I was asked this week by somebody keen to begin programming where to start. Python was somewhat of a surprising choice for me since my weapon of choice is generally C#, but there you go.

When I went to university in the 1980s, the languages they taught us were mostly "languages for learning" like Pascal. As a commercial proposition, it wasn't until the release of Turbo Pascal that any kind of commercial work appeared but we were learning Pascal on a VAX. While it was OK for teaching the basics of structured programming, it was very poor at preparing us for the meat and potatoes land of C or assembly and didn't have any object orientation. The course did skim over Lisp at one point and we eventually ended up at C in the third year.

In defence of the teaching choice, in the 1980s there were no clear winners as a good teaching language - companies were still able to sell machines with proprietary operating systems, strange home-grown languages etc. so the general idea was to pass on general programming knowledge rather than specifics

Today however, everything is a Unix machine or tries to resemble one and python is either already available or easily installed. Compared to Java, the installation is generally easier, setting up your first program is much simpler and python programs (as a rule) don't require a hundred lines of generated boiler plate code to get started (hello C#). Compared to bash, the syntax is more consistent and python has more high-level concepts that are useful in other languages like java, C#, C etc.

It is easy to get started

I'm going to make it more complicated to get started than it should be, but really if you want to leverage the massive python resources on the web for learning, you are better off doing it within a Unix-like environment.

The instructions I gave to the beginner

Controversial opinion: If you own a mac, follow these instructions. The instructions give you some idea of just how hostile the Mac is for development in recent times. There is a whole, nice BSD unix hiding under there and Apple want to make it as difficult to access as they possibly can. Maybe trade that mac in, the resale on them is good. Not that Windows is any less user hostile in different ways, but at least you can still use one for programming without waiting half a day for XCode to install.

On Windows, for the best experience, first install "Windows Subsystem for Linux" version 2. It's in the Microsoft app store or just follow the instructions here: https://docs.microsoft.com/en-us/windows/wsl/install

Controversial opinion: Python can be installed on windows directly, but the experience is frustrating once you get the first steps beyond beginner. The old Windows command interpreter is low grade dog food without any of the conveniences of bash like command completion that works, command history that works, sensible escaping of whitespace in commands, a file system that isn't crippled by case insensitivity and a load of other stuff that has baked my noodle since first encountering DOS in the 1980s. Why it is still around is a mystery.

If you are a beginner reading this, WSL is a "virtual machine" (i.e. a fake machine) that pretends it has access to the whole computer. In this case, you can install an entire other operating system on there. Microsoft supply this because all their customers who use Windows to develop software are moving to Linux for servers on the net, but Windows command line/windowing things don't work very well with Linux style server software.

I normally install the "Debian" distribution but there are other good choices (Ubuntu etc). Debian is easy to find help for and used commercially in a lot of places (including SmartShepherd, on pretty much everything).

Once that is installed, I can't remember whether python is installed by default or not, but you can install it by opening your new Debian terminal and typing in this stuff:

sudo apt-get install python3
sudo apt-get install python3-pip
  • The "sudo" thing is "super user do", used to elevate your user privileges so you can install software in places you don't normally have access to.
  • "apt-get" is the software package manager command for getting new software.
  • "install" tells apt-get that you want to download a package you don't have already.
  • "python3" is the current package we want to install
  • "python3-pip" is the "pip" command for installing python libraries. You will need pip to grab libraries that aren't downloaded by the default python install. python has a tonne of useful libraries for doing things like bluetooth or graphics, or web hosting.

A typical python program is just a text file. If you open up a terminal, you can either use Notepad in windows to write out a python file or you can use "nano" or "vi" inside the terminal to create a text file.

An alternative for when he really gets going is "Visual Studio Code" or VSCode. I use that a lot myself because it runs on mac/linux/windows and behaves identically everywhere. Microsoft have a special mode for VSCode so that if you install it, and you're inside a Debian terminal, typing "code" will bring up the graphical version of VSCode. Lots of instructions on the web for getting started with that.

Controversial opinion: I would stick to nano to start with. "vi" is what most people use on Linux (maybe another thing called emacs) but the learning curve for vi is pretty tough. vi and emacs have been around since the 1970s and they are set up for people who had an actual glass terminal on their desk instead of a modern machine with graphics and whatnot. nano is a bit simpler to use as a text editor. In this case, since we want to learn python and not the entire Unix like ecosystem, nano is a good choice.

As an example, the Digital Ocean people also use nano for their beginner demonstration: link

That link is a good intro to getting started now that you have everything else set up. Good luck!

It is extremely popular and easy to get help with.

Some good resources for getting started with python and doing useful things:

W3Schools python course

Python org getting started.

When you move on from simple python programs, try an IDE and get a debugger:

Visual Studio Code python

Popular posts from this blog

Tailscale ate my network (and I love it)

Stupid stunts with WSL2 , Python3 and AWS ECS

Time machine: Solaris 2.6 on QEMU