[PYTHON MATRIX-SIG] Thoughts on latest messages

David Ascher da@maigret.cog.brown.edu
Tue, 16 Jan 1996 15:47:50 -0500 (EST)

Paul Dubois:

>c. If you want to make a Whatzit in Python that encapsulates a Thing but
>adds some special semantics (say, for example, arrays whose lower index
>is not 0) you can almost do it perfectly with a wrapper class but the
>one thing you can't spoof is when the object is an argument to something
>that expects a Thing. viz, sqrt(m). If I understood you, the idea would
>be that all routines expecting a Thing would, finding that they hadn't
>gotten one, try to do getattr(m, '__array__') so that objects that
>wished to pretend they are Things could do so. I think this will prove
>very valuable and can testify that I already ran into a case where it
>would have been a nice solution for me.

Same here.  It's a scheme similar to that used by Brian Werkentine in
Rivet (you can call rivet functions w/ rivetobjs or with classes with a
__widget attribute which is a rivetobj).  It makes lots of things much
much simpler.

Examples that I've been thinking about are "documented matrices", (class
instances with names and properties for the various dimensions) and
"visible matrices" (class instances with state information for displayed


MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org