Multimethod.py -- multimethods in Python

Neel Krishnaswami neelk at brick.cswv.com
Wed Jan 12 02:17:13 EST 2000


I'd like to announce the existence of Multimethod.py, a package that
implements real (eg, CLOS/Cecil/Dylan) multimethods for Python. These
are nifty for oodles of reasons, but some of the more significant are:

  o They make the Visitor and Strategy patterns trivial to implement.
  
  o The whole "binary method/double dispatch" problem goes away, thus 
    promoting loose coupling and other software-engineering buzzwords.
  
  o They resolve the whole contravariance/covariance debate so totally
    it's hard to remember what the problem was.

You can find it on my webpage at:

  <URI:http://www.sff.net/people/neelk/open-source>

It should work out of the box on CPython 1.5.2, and Jpython if Jpython
has lists that support the insert() method. I don't know about Viper,
since Viper apparently has a rather different type system from vanilla
Python, but it should be easy to port, though.

The current version is quite rough, with lame algorithms used in a
couple of places and very substandard documentation. But it all works,
and is quite usable for experimentation and learning.

(Incidentally, is this the sort of thing that should go on the
types-sig?)


Neel

<P><A HREF="http://www.sff.net/people/neelk/open-source">Multimethod.py</A> - 
support for real (i.e. CLOS/Cecil/Dylan-style) multimethods for
Python.  (07-Jan-2000)

-- 
----------- comp.lang.python.announce (moderated) ----------
Article Submission Address:  python-announce at python.org
Python Language Home Page:   http://www.python.org/
Python Quick Help Index:     http://www.python.org/Help.html
------------------------------------------------------------



More information about the Python-list mailing list