[Numpy-discussion] *= operator not intuitive

Chris Barker Chris.Barker@noaa....
Wed Mar 16 09:49:52 CDT 2011


On 3/16/11 6:34 AM, Charles R Harris wrote:
> On Wed, Mar 16, 2011 at 7:24 AM, Paul Anton Letnes

> Yes, it is intentional. Numpy is more C than Python in this case,

I don't know that C has anything to do with it -- the *= operators were 
added specifically to be "in-place" operators -- otherwise they would be 
nothing but syntactic sugar. And IIRC, numpy was one of the motivators.

IMHO, the mistake was even allowing += and friends for immutables, as 
that inherently means something different.

Of course, using += with integers is probably the most common case.

-Chris





More information about the NumPy-Discussion mailing list