Extension types: conflicting use of "*"

Olaf Delgado delgado at olaf.de
Thu Jun 15 14:18:39 EDT 2000


Hi Folks!

Let me first say that I do not write a lot to this group, but enjoy
reading it immensely. Thank you guys!

I am currently trying to put together an extension type for "small"
floating point matrices. Suddenly, after some supposedly innocent
changes, multiplication did not longer work. More precisely, whenever
I wrote a*b, the interpreter tried to do b*a. This is extremely
undesirable for matrix multiplication, as opposed to, say, integer
multiplication. :)

It turned out that this strange behaviour was toggled by supplying a
PySequenceMethods entry to the type object. Oops! I'm not quite sure
what exactly happens and do not feel like digging into the source code
either (well, at least not at the very moment). Perhaps someone else
knows and is willing to explain?

Right now, I have to write A[lo:hi:] instead of A[lo:hi], which is not
too bad. I need a special method to retrieve the list of rows in case
I want to loop over them, which is not too much of a pain, either.

Anyway, all this makes me look forward to Python 3k, the interpreter
of milk and honey. :)

Thanks for your attention!

Olaf

-- 
  ////
  Olaf  Delgado Friedrichs, Bielefeld, Germany
  `='   --- http://www.mathematik.uni-bielefeld.de/~delgado ---



More information about the Python-list mailing list