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
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 assi
Hi,On 8/26/06, Albert Strasheim <[EMAIL PROTECTED]> wrote:
A complete code snippet that reproduces the bug would be most helpful.+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
--
Hi,On 8/26/06, Bill Baxter <[EMAIL PROTECTED]> wrote:
You're sure it's not just pass-by-reference semantics biting you?If you make an array and pass it to another class or function, by default they just get a reference to the same array.so e.g.:a = numpy.array
([1,2,3])some_class.set_array(a)a[1]
Behalf Of Sven Schreiber
> Sent: 26 August 2006 14:14
> To: numpy-discussion
> Subject: [Numpy-discussion] memory corruption bug
>
> Hi,
> I experienced this strange bug which caused a totally unrelated variable
> to be overwritten (no exception or error was raised, so it t
I appreciate your warnings, thanks. However, they don't seem to apply
here, or why would my described workaround work at all in that case?
Also, afaict, the affected variable is not even passed to the class
where the problematic assignment happens.
-sven
Bill Baxter schrieb:
> You're sure it's not
You're sure it's not just pass-by-reference semantics biting you?If you make an array and pass it to another class or function, by default they just get a reference to the same array.so e.g.:a = numpy.array
([1,2,3])some_class.set_array(a)a[1] = 10Then both the local 'a' and the 'a' that some_class
Hi,
I experienced this strange bug which caused a totally unrelated variable
to be overwritten (no exception or error was raised, so it took me while
to rule out any errors of my own).
The context where this is in is a method of a class (Vecm.getSW()), and
the instance of Vecm is created within a