In this post, we will see a way of implementing a list in Python that can be indexed with an integer or string representing the
name attribute of a stored object.
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.
Sometimes, you may wish to check within a script when a configuration file or the script itself changes, and if so, then automatically restart the script. In this post, you will see a way of doing this in Python.