Moving from Perl to Python

Created 2021-04-27.

The need for a programming language

As I'm planning a transition to a modern static site generator I need some scripts and utilies to convert the data and the content from the earlier techologies into format compatible with the new static site generator. And writing these require a programming language.

How I chose Python

The languages that I've previously used include Java, JavaScript, PL/SQL, Ruby, Perl, C, C++, Lisp, Prolog, Visual Basic and Fortran.

Perl would be the most obvious and the easiest choice for me and I would be productive starting from the first second. But I decided this was the time to try something different, perhaps a new programming language. And perhaps was the right time to move from Perl altogether.

I ruled out Perl and listed some key candidates: Go, Python, Ruby, Rust. Since I was looking for a reasonable smooth transition from Perl I felt that this left out Go and Rust. So finally only two candicates were left: Python and Ruby.

I've already been programming with Ruby but Python was a new language for me. I decided to go with Python.

These are the key benefits of Python

  • as a general-purpose interpeted language offers a smooth enough transition from Perl
  • an easy to read
  • very likely to be alive at least ten years - at least to year 2031
  • works well on both Windows and Linux
  • excellent libraries
  • anything I decide to ask about Python programming Google search gives me an answer

Transition from Perl to Python

As I'm making a transition from Perl to Python as an avid Perl programmer here are some key things I've noticed.

Indentations are important part of the language. This goes so far that a tab indentation is different from indentation done with spaces and mixing them leads to an error inconsistent use of tabs and spaces in indentation.

At first I found it strange not to use { } and instead use : and indentation. But after first two hours of programming I feel that I never like to go back to those { }'s.

Perl variables indicated with $, @ and % are a mess. I don't miss them.

function defintions and calls always ends with () which I find very logical