Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Main characteristics

We are going to list few characteristics of the Python language and of its ecosystem.

Open-source:

The language, most interpreters and large parts of the ecosystem...

Interpreted?

Most of the time Python code is interpreted. However, there are tools to compile Python code (Ahead Of Time).

Dynamically strongly typed: objects, types and variables

We have already seen in First steps pure Python: objects, types and variables than objects, types and variables are very different things in Python.

Spaces for objects and variables (names)

Objects and variables (names) live in different places:

It is often interesting to represent the execution of a Python program in an “object space - namespaces” diagram.

Automatic memory management

Python uses a garbage collector.

A philosophy: the Zen of Python

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

Gradual learning curve

Simple things are simple. However, Python is not a simple language.

Only few keywords and built-in functions

There is a limited number of keywords and other builtins:

help("keywords")

Here is a list of the Python keywords.  Enter any keyword to get more help.

False               class               from                or
None                continue            global              pass
True                def                 if                  raise
and                 del                 import              return
as                  elif                in                  try
assert              else                is                  while
async               except              lambda              with
await               finally             nonlocal            yield
break               for                 not                 

Focus on readability

“Code is more often read than written.” - Guido von Rossum

Indentation defines the blocks

for idx in range(5):
    value = idx**2
    print(f"{idx}: {value = }")
print("This is the end")
0: value = 0
1: value = 1
2: value = 4
3: value = 9
4: value = 16
This is the end

Style coding is important: PEP 8

PEP8: examples of bad and good style practices

# fmt: off
# bad (spaces between operator)
number=0
# fmt: on

# ok
number = 0
# fmt: off
# bad (indentation with 2 spaces, has to be 4)
if number == 0:
  number = 1
# fmt: on

# ok
if number == 0:
    number = 1
# fmt: off
# bad (space after ,)
mylist = [1,2,3]
# fmt: on

# ok
mylist = [1, 2, 3]

Errors should never pass silently

Multi-paradigm (sequential, object-oriented, functional)

“Batteries Included”: the standard library

A reference interpreter and few alternative interpreters

Huge success, strong community and huge ecosystem

In 2024:

GitHub also provides insights into their users’ language preferences:

  • The top three programming languages are JavaScript, Python, and Java.

  • PHP has decreased in popularity, dropping from sixth to seventh place in 2022.

  • The Hashicorp Configuration Language (HCL) is the fastest-growing language on GitHub, with a usage increase of 56.1 percent.

  • Rust experienced a growth rate of more than 50 percent, which GitHub attributes to its security and reliability.

  • Python continues to grow in popularity, with a 22.5 percent increase per year.

JOSS reviews are primarily about the software, and so it would be remiss of us not to talk about that. Python is still the #1 language for JOSS submissions, used in part for well over half of published papers (~1200 out of 2000). R is #2 at 445 submissions, and C++ #3 (although of course C++ and C may be used together with another language).