skip to navigation
skip to content

multimethod 0.2.1

Multiple argument dispacthing.

Downloads ↓

Latest Version: 0.3

Multiple argument dispacthing.

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.  For example:

    @multimethod(*types)
    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 will be called (and cached).
A function can have more than one multimethod decorator.

See tests for more example usage.
Supported on Python 2.5 or higher, including Python 3.x.
 
File Type Py Version Uploaded on Size # downloads
multimethod-0.2.1.tar.gz (md5) Source 2009-05-11 2KB 666