Why learners find classes and objects confusing

Posted on Tue 05 August 2025 in Software • Tagged with python, object-oriented-programming, teaching

One reason why Python is such a popular and powerful language is that it is straightforward to learn and make good progress. Learners can quickly become comfortable with many aspects of the language, such as control flow and functions.

The first obstacle that many learners come across is when they …


Continue reading

Logging in Python

Posted on Sun 07 July 2024 in Python • Tagged with python, backend

Having reliable, detailed but searchable logs is an essential part of any application, especially of long-running services that need to be debugged and monitored for uptime and stability. As one of the oldest modules in the Python standard library, the logging module provides a very powerful set of tools for …


Continue reading

Object creation patterns in Python: Static factory methods

Posted on Tue 21 May 2024 in Python • Tagged with python, object-oriented-programming, design-patterns

The basic way to create and initialize an object in Python is using the default constructor, defined as the __init__() method:

class MyClass:
    def __init__(self, x: float) -> None:
        self.x: float = x
        print(f"created an object with x = {x}")


obj = MyClass(5)

Usually, initial values of instance variables …


Continue reading

for loops in Python are a bit weird

Posted on Sun 11 February 2024 in Python • Tagged with python, javascript

A quiz:

What does the following JavaScript code print and why?

for (let i = 0; i < 3; i++) {
  console.log(i);
  i -= 3
}

What does the following Python code print and why?

for i in range(3):
    print(i)
    i -= 3