Blog Posts
-
What is a closure and what is it used for?
dr. Dobreff Csaba 23rd márc 2026In Python, closures appear in many different use cases. For example, decorators, which are one of the characteristic language constructs in Python, are built on them. A function that is...
-
Why Lists Should Be Homogeneous but Tuples Can Be Heterogeneous?
dr. Dobreff Csaba 14th márc 2026In Python, a list can hold objects of any type. A list is a mutable container, which means that its elements can be replaced during program execution, and the number...
-
setdefault() vs defaultdict — Which Should You Use?
dr. Dobreff Csaba 11th márc 2026Both of these Python features are designed to handle the same situation: when a key is missing from a dictionary, they automatically create it with a specified default value. If...
-
How Can You Check If an Object Is Iterable?
dr. Dobreff Csaba 10th jan 2026You’ve probably already heard of iterable objects and iterators — and you’ve likely used them, too. These include any objects you can loop through using a for-loop, retrieving one element...
-
Did you know that you can create instances of a class using different sets of arguments?
dr. Dobreff Csaba 10th jan 2026Let’s consider a class that makes it possible to create triangle instances based on the lengths of their three sides. In this case, the __init__ method accepts three parameters, one...
-
How to Increase Code Flexibility with Function and Method Overloading
dr. Dobreff Csaba 10th jan 2026In this post, code flexibility refers to how much existing code needs to be changed when new requirements arise. A flexible piece of code is one where new needs can...
-
How to Make Long Numbers Easier to Read in Code
dr. Dobreff Csaba 10th jan 2026When working with large numbers in code, readability matters — especially when numbers have five or more digits. Just as we often group digits in threes when writing numbers in...
-
Finding the Right Way to Learn Python (It’s Not One-Size-Fits-All)
dr. Dobreff Csaba 10th jan 2026When deciding how to learn Python (or programming in general)—whether through an instructor-led course or through self-study using books or videos—there are several factors to consider. The best choice depends...
-
What to Consider When Creating a Dictionary with dict.fromkeys()?
dr. Dobreff Csaba 10th jan 2026In Python, there are several ways to create a dictionary.One of them is by calling the class method [crayon-6a68c321955d6104784038-i/]. This approach is convenient when you want to initialize a dictionary...
-
How to Create an Iterator That Interleaves Elements from Iterable Objects
dr. Dobreff Csaba 10th jan 2026When working with multiple data sources or sequences, we sometimes need to interleave their elements — for example, by combining readings from several sensors in time order, distributing tasks evenly...