[Numpy-discussion] Ransom Proposals

Colin J. Williams cjw at sympatico.ca
Tue Mar 28 06:11:08 EST 2006


Travis Oliphant wrote:

> Charles R Harris wrote:
>
>>     Really? If so, this is a version thing. This is what I get 
>> running on
>>     Python 2.4.1 and current numpy SVN (0.9.7.2286):
>>
>>          >>> 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])
>>
>>
>> Ugh. IMHO, this should throw an error. For these sort of assignment 
>> operators I think the right hand side should be cast to the type of 
>> the left, which I think of as some sort of fancy register variable. 
>> If anything, the list should be appended to. I'll have to try the 
>> latest SVN just to appreciate this.
>>
>
> Again,  this is a Python thing.  Numeric has this behavior as well.   
> Depending on your point of view it's either a great thing or a wart.

A wart +1

Colin W.




More information about the NumPy-Discussion mailing list