- Published on
Quite often you want to perform some kind of action, based on the type of the argument provided to the function. There are multiple ways of doing that. Most of the time I would create a dictionary with a mapping, but there are cleaner solutions to that problem. Python Standard Library provides many tools for writing cleaner, and safer code.