Subject: ANN Multimethod.py -- multimethods for Python - DN [1]


neelk@brick.cswv.com (Neel Krishnaswami) - 08 Jan 2000 - comp.lang.python

 [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

Last modified
2000-01-21

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated