functools is used with and for callable objects. singledispatch allows for a rudimentary function overloading: from functools import singledispatch
@singledispatch
def F(a):
print('F was called')
# Overload F for an int
@F.register(int)
def _(a):
print('F was called, the argument is an int')
# Overload F for a str
@F.register(str)
def _(a):
print('F was called, the argument is a str')
F([])
F(42)
F('Hello world')
pkgutil.simplegeneric.