[Python-Dev] INPLACE_ADD and INPLACE_MULTIPLY oddities in ceval.c

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Mar 29 02:38:55 CEST 2006


Travis E. Oliphant wrote:

> I can't imaging anybody relying on an in-place operations to return a 
> "different" object, but we could make the change and run all the 
> NumPy/SciPy tests to see what happens.

I'm really thinking more about the non-inplace operators.
If nb_add and sq_concat are collapsed into a single slot,
it seems to me that if you do

   a = [1, 2, 3]
   b = array([4, 5, 6])
   c = a + b

then a will be asked "Please add yourself to b", and a
will say "Okay, I know how to do that!" and promptly
concatenate itself with b.

This would be very different from the current behaviour
of Numeric arrays. I don't know whether Numeric users
would consider it a serious problem or not, but I
think we need to consider the implications before
charging ahead too fast with slot unification.

--
Greg


More information about the Python-Dev mailing list