Structures and Member Initializers in C++

Since C++11, one can put the initialization of data members directly into structure or class definition. However, this change has consequences with regards to the construction of such structures. Indeed, by adding member initializers into a structure may render your previously working code non-compilable. In the present post, I describe this change, the related issues, and explain how to get around them.
Read More

Unit-Testing With unittest.mock.patch()

Sometimes, you need to unit-test functions that call functions from the standard library that rely on side effects. In this post, I show a way of doing so in Python with unittest.mock.patch(). More specifically, we implement two context managers that use os.chdir() to perform actions in the given directory, and show a way of unit-testing them without relying on the file system.
Read More