Implementing multimethods in Python

1 · Adam Bard · Dec. 11, 2014, midnight
In Clojure (and many other languages), a multimethod is an implementation of multiple dispatch as an alternative to single dispatch. Traditionally, if you define several methods with the same name on different classes, the type/class of the first argument (in Python, self, in many other languages implicit) is used to pick which method to call. This is called “single dispatch” because the decision of which method to call is left up to the inferred type of a single argument. Multimethods take the ...