[Numpy-discussion] Ransom Proposals
Travis Oliphant
oliphant at ee.byu.edu
Mon Mar 27 16:07:01 EST 2006
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.
-Travis
More information about the NumPy-Discussion
mailing list