src.multimethod package
Submodules
src.multimethod.multimethod module
- class src.multimethod.multimethod.Function(fn)
Bases:
objectFunction is a wrap over standard python function
An instance of this Function class is also callable just like the python function that it wrapped. When the instance is “called” like a function it fetches the function to be invoked from the virtual namespace and then invokes the same.
- key(args=None)
Returns the key that will uniquely identifies a function (even when it is overloaded).
- class src.multimethod.multimethod.Namespace
Bases:
objectNamespace is the singleton class that is responsible for holding all the functions.
- get(fn, *args)
get returns the matching function from the virtual namespace.
return None if it did not fund any matching function.
- static get_instance()
- register(fn)
registers the function in the virtual namespace and returns an instance of callable Function that wraps the function fn.
- src.multimethod.multimethod.multimethod(fn)
overload is the decorator that wraps the function and returns a callable object of type Function.