Singledispactch

In a dynamically typed language like Python, there is often a need to perform slightly different operations based on the type of an argument, especially when dealing with the difference between a list of items and a single item. It is simple enough to check the type of an argument directly, but in cases where the behavioral difference can be isolated into separate functions, functools provides the singledispatch() decorator to register a set of generic functions for automatic switching based on the type of the first argument to a function. Screenshot (88).png