[Python-Dev] Inplace multiply (original) (raw)

Michael Hudson mwh@python.net
Wed, 14 May 2003 10:53:04 +0100


"Paul Dubois" <paul@pfdubois.com> writes:

My "masked array" class MA has a problem that I don't know how to solve. The inplace multiply function

def imul (self, other) is not getting called while my other input operations do work. The scenario is x = MA.array(...) x *= c If c is an int, this works correctly, calling MA.imul. Otherwise, I get a message from the Python runtime saying it can't multiply a sequence by a non-int. But change MA to Numeric, it works. Numeric is an extension type and MA is a (new style) class. MA defines len as well as all the math operators.

What version of Python? This smells like a bug that has been (thought) fixed.

Cheers, M.

-- The ability to quote is a serviceable substitute for wit. -- W. Somerset Maugham