Blog Posts
-
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-69e73491367c3730472298-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...
-
What is the Role of __main__, and When to Use It?
dr. Dobreff Csaba 10th jan 2026In Python scripts, you may sometimes see a code block starting with if __name__ == ‘__main__‘:, but it’s not always there. Why is that? The answer lies in the fact...
-
When and Why Should You Use Fractions in Calculations?
dr. Dobreff Csaba 10th jan 2026In earlier posts, we discussed how the [crayon-69e7349136d3b723051403-i/] module can help mitigate the precision limitations inherent in Python’s float type. However, even the [crayon-69e7349136d3c811747550-i/] type cannot provide infinite precision. This...
-
How to Round Numbers in Python
dr. Dobreff Csaba 10th jan 2026In the previous post, we used Python’s standard library [crayon-69e7349136e66752069926-i/] module for applications that require high precision. We also saw examples showing how changing the desired precision through the context...
-
How to Perform Calculations Requiring High Numerical Precision
dr. Dobreff Csaba 10th jan 2026When you perform arithmetic operations in Python using float operands, you may notice that the results aren’t always exact—even when the expected outcome is a finite decimal or an integer...
-
Coroutines and Their Applications
dr. Dobreff Csaba 10th jan 2026In the previous post, we talked about generators. We described them as special kinds of iterators that allow two-way data transfer between the calling program and the generator itself. This...
-
Do You Know the Difference Between an Iterator, a Generator, a Generator-Iterator, an Iterator Generator, a Generator Function, and a Generator Expression?
dr. Dobreff Csaba 10th jan 2026This is not a play on words — these are fundamental Python concepts that may not be entirely clear to everyone learning the language. Let’s briefly summarize their essence below....
-
What Is Monkey Patching?
dr. Dobreff Csaba 10th jan 2026Python is a remarkably flexible language when it comes to defining attributes.Because of this, Python users may encounter the term monkey patching, which refers to dynamically extending or modifying an...
-
When to use an operator vs a function?
dr. Dobreff Csaba 10th jan 2026In Python, most problems can be solved in several ways using different language constructs. For example, many operations have dedicated operators, but there are also functions or methods that achieve...