[Numpy-discussion] Ransom Proposals

Travis Oliphant oliphant at ee.byu.edu
Mon Mar 27 15:41:02 CST 2006


Tim Hochberg wrote:

>> Charles R Harris wrote:
>>
>>     >>> l = list(a)
>>     >>> l
>>    [999, 1, 2, 3, 4, 5, 6, 7, 8]
>>     >>> a
>>    array([999,   1,   2,   3,   4,   5,   6,   7,   8])
>>     >>> l += a
>>     >>> l
>>    array([1998,    2,    4,    6,    8,   10,   12,   14,   16])
>>     >>> a
>>    array([999,   1,   2,   3,   4,   5,   6,   7,   8])
>
>
>
> Let me add that I think that this is pretty dubious, so if this is a 
> new feature, perhaps we should revert it before it becomes entrenched.


I don't think it's a new feature, but it's simply the result of

l += a being translated to

l = l + a  # lists don't have in-place add's

Numeric has this behavior as well.

-Travis








More information about the Numpy-discussion mailing list