[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Would you consider this a bug?



David Kastrup wrote:
> a=[3,4,5]
> a[[2,1,0]] = a
> 
> a will be set to [3,4,3]
> 
> Would you think this a bug?

I think this is extremely dangerous programming: you might get
undefined or unpredictable results with almost any programming language
in this type of case. The clean way of doing what you want is to
index the right side of the expression:
a = a[[2,1,0]]

I don't think this is a bug.

Kevin
-- 
  Kevin Ivory                           Tel: +49 5556 979 434
  Max-Planck-Institut fuer Aeronomie    Fax: +49 5556 979 240
  Max-Planck-Str. 2                     mailto:Kevin.Ivory@linmpi.mpg.de
D-37191 Katlenburg-Lindau, GERMANY      http://www.gwdg.de/~kivory2/