A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2003-May/035591.html below:

[Python-Dev] Inplace multiply

[Python-Dev] Inplace multiply [Python-Dev] Inplace multiplyPaul Dubois paul@pfdubois.com
Tue, 13 May 2003 10:25:38 -0700
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.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4