[SciPy-user] SciPy-user Digest, Vol 29, Issue 11
Travis Oliphant
oliphant.travis at ieee.org
Fri Jan 6 18:06:16 EST 2006
Fernando Perez wrote:
>Travis Oliphant wrote:
>
>
>
>>Ultimately this is because you can't tell whether you simply have
>>
>>b = a # We really could resize a because b is just another name for a...
>>
>>or this
>>
>>b = a[1:5:2,0:3:2] # now b is a *view* of a's memory. If we resize a,
>>then b is really going to be messed up and give us problems.
>>
>>We could distinguish these two using another array flag like (SHAREDATA)
>>or something.
>>
>>
>
>I'm not sure that can work in python:
>
>In [3]: a = N.arange(10)
>
>In [4]: b = a[::2]
>
>a.SHAREDATA is now true
>
>In [5]: del b
>
>a.SHAREDATA is still true, but shouldn't.
>
>
You are right. We would also have to have a variable storing the number
of shares, and then objects that share the data would have to decrement
it correctly. So, it's a lot harder than a simple flag. In fact, I
don't think we should pursue it...
-Travis
More information about the SciPy-User
mailing list