[SciPy-user] SciPy-user Digest, Vol 29, Issue 11

Fernando Perez Fernando.Perez at colorado.edu
Fri Jan 6 17:53:59 CST 2006


Travis Oliphant wrote:
> 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...

As I said, it's reference counting, in a language with automatic memory 
management.  You'd have to impose that any object which refers to another MUST 
always call a .close() method, much like is done with files (python doesn't 
guarantee that it closes files when they go out of scope, only when the 
interpreter shuts down).

I don't think any of us wants to have to write;

b = a[::2]
c = z[1::3]
...


b.close(); c.close();...
return


This is slow, error prone and annoying.  So let's not :)

Cheers,

f



More information about the SciPy-user mailing list