skip to navigation
skip to content

Not Logged In

multimethod 0.5

Multiple argument dispatching.

About Multimethod

Multiple argument dispatching.

Call multimethod on a variable number of types. It returns a decorator which finds the multimethod of the same name, creating it if necessary, and adds that function to it.

def func(*args):

func is now a multimethod which will delegate to the above function, when called with arguments of the specified types. If an exact match can’t be found, the next closest method is called (and cached).

If strict mode is enabled, and there are multiple candidate methods, a TypeError is raised. A function can have more than one multimethod decorator. Keyword arguments can be used when calling, but won’t affect the dispatching.

The functools.singledispatch style syntax introduced in Python 3.4 is also supported.

def func(*args):

def _(*args):

See tests for more example usage.


Standard installation from pypi or local download.

$ pip install multimethod
$ python install


Python 2.7 or 3.2+.


100% branch coverage.

$ py.test [--cov]



  • Dispatch on Python 3 annotations


  • Optimized dispatching
  • Support for functools.singledispatch syntax
File Type Py Version Uploaded on Size
multimethod-0.5.tar.gz (md5) Source 2015-09-04 4KB
  • Downloads (All Versions):
  • 13 downloads in the last day
  • 63 downloads in the last week
  • 321 downloads in the last month