Python quirks

Exception Chaining In Python

Today I read some Python code and I asked myself "mmm what? How does it work? What's the meaning of raising an exception from another one? In this article I'll answer on: What is an exception?What is an exception chaining?Why is it important to use it?How to chain exceptions in Python? Let's get started! Introduction… Continue reading Exception Chaining In Python

Python quirks

Structural Pattern Matching In Python

Once upon a time, Guido van Rossum, the Python creator, decided to reject a simple feature (PEP 3103): Switch case The reason for rejecting this PEP is: A quick poll during my keynote presentation at PyCon 2007 shows this proposal has no popular support. I therefore reject it.~ Guido van Rossum Lots of software developers… Continue reading Structural Pattern Matching In Python

C++ quirks

I Like To Move It Move It

In the last article, I explained the different value categories. In this article, I'll elaborate on the C++ move semantics. Let's review this code: #include <iostream> #include <string> class DataStructure { public: DataStructure (uint64_t size) : m_size(size), m_data(new uint64_t[m_size]) { print("ctor"); } ~DataStructure () { print("dtor"); if (m_data) { delete[] m_data; m_data = nullptr; }… Continue reading I Like To Move It Move It