Concatenating in Numpy with r_ and c_

In Numpy, the r_ and c_ class objects are utilities that allow users to concatenate objects using slice notation. In this post, I explain how to make the most out of them by modifying its string notation and I measure their performance for concatenating and for reshaping.
Read more →

Context Managers with Python’s contextlib

Because managing resources in Python is better with context managers — and context managers are easier with contextlib. This article is a small tutorial on why context managers are easier with contextmanager from contextlib, where its similarities to a full implementation of with-statement context managers start to become blurrier, and how to effectively handle exceptions.
Read more →