[ANN] Multimethod.py -- multimethods for Python

Neel Krishnaswami neelk at brick.cswv.com
Fri Jan 7 19:54:36 EST 2000


[This is a repost, since the original apparently never made it; if you
see it twice, my apologies.]

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 hacking.

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


Neel



More information about the Python-list mailing list