Python 3

Python 3 – Function Overloading with singledispatch

Python fairly recently added partial support for function overloading in Python 3.4. They did this by adding a neat little decorator to the functools module called singledispatch. This decorator will transform your regular function into a single dispatch generic function. Note however that singledispatch only happens based on the first argument’s type. Let’s take a …

Python 3 – Function Overloading with singledispatch Read More »

Python 3 – An Intro to Type Hinting

Python 3.5 added an interesting new library called typing. This adds type hinting to Python. Type hinting is kind of declaring your functions arguments to have a certain type. However the type hinting is not binding. It’s just a hint, so there’s nothing preventing the programmer from passing something they shouldn’t. This is Python after …

Python 3 – An Intro to Type Hinting Read More »