danwerner/multimethods — pull request #3 by exupero (2012-01-10 23:19:12+00:00)
Title: Added module-based namespacing.

Here's a simple implementation that just uses the module of the dispatch function. It does constrain the dispatch function and all the methods to be defined within the same module, which may be a problem in some scenarios.

Alternatively, there could be an optional keyword argument to override a default namespacing:

frobz = MultiMethod('frobz', dispatch_fn, namespace='myproject')

@method('bla', namespace='myproject')
def frobz(x):
...

This is no more concise than [your example](https://github.com/danwerner/multimethods/pull/2#issuecomment-3437271), but it does have your existing conciseness if module-based namespacing is acceptable.