Re: [Numpy-discussion] memory corruption bug

2006-08-28 Thread Bill Baxter
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

Re: [Numpy-discussion] memory corruption bug

2006-08-28 Thread Sven Schreiber
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

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Charles R Harris
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 --

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Charles R Harris
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]

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Albert Strasheim
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

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Sven Schreiber
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

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Bill Baxter
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

[Numpy-discussion] memory corruption bug

2006-08-26 Thread Sven Schreiber
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