Nope, that's the way python works in general for any type other than
basic scalar types.
>>> a = [1,2,3,4]
>>> b = a
>>> b[1] = 99
>>> print a
[1, 99, 3, 4]
>>> print b
[1, 99, 3, 4]

Also the issue never comes up for types like tuples or strings because
they aren't mutable.

--bb

On 8/28/06, Sven Schreiber <[EMAIL PROTECTED]> wrote:
> Charles R Harris schrieb:
> > +1. I too suspect that what you have here is a reference/copy problem.
> > The only thing that is local to the class is the reference (pointer),
> > the data is global.
> >
> > Chuck
>
> Ok, so you guys were right, turns out that my problem was caused by the
> fact that a local assignment like x = y is also by reference only, which
> I wasn't really aware of. (Of course, it's explained in Travis' book...)
> So that behavior is different from standard python assignments, isn't it?
>
> Sorry for the noise.
>
> -Sven
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to