[Numpy-discussion] Re: Ransom Proposals

Robert Kern robert.kern at gmail.com
Tue Mar 28 11:05:01 CST 2006


Christopher Barker wrote:

> And then we have this (already pointed out in this thread)
> 
>>>> l = [1,2,3]
>>>> l
> [1, 2, 3]
>>>> a
> array([4, 6, 8])
>>>> l += a
>>>> l
> array([ 5,  8, 11])
> 
>>>> b
> [4, 6, 8]
>>>> l = [1,2,3]
>>>> l += b
>>>> l
> [1, 2, 3, 4, 6, 8]
> 
>>>> l = [1,2,3]
>>>> t = (3,4,5)
>>>> l+=t
>>>> l
> [1, 2, 3, 3, 4, 5]
> 
> How this is anything but a bug is beyond me! Lists do define the
> in-place operator, and really do it in-place. That being the case, I
> would certainly never expect += to change the type of a list! It doesn't
> with a tuple. Is this a numpy issue or a Python one?

A Python one.

http://mail.python.org/pipermail/python-dev/2006-March/062889.html

-- 
Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco





More information about the Numpy-discussion mailing list