Re: Questions about file object and close()

2004-12-09 Thread John Marshall
On Thu, 2004-12-09 at 10:33 -0500, Peter Hansen wrote: > John Marshall wrote: > > It seems to me that a file.__del__() _should_ > > call a file.close() to make sure that the file > > is closed as a clean up procedure before > > releasing the object. > > I believe it does, but I tried your experim

Re: Questions about file object and close()

2004-12-09 Thread Scott David Daniels
John Marshall wrote: On Thu, 2004-12-09 at 08:41 -0500, Peter Hansen wrote: John Marshall wrote: Does anyone see a problem with doing: data = file("tata").read() ... a perfectly good explanation It seems to me that a file.__del__() _should_ > how he wishes it were designed Isn't

Re: Questions about file object and close()

2004-12-09 Thread Peter Hansen
John Marshall wrote: It seems to me that a file.__del__() _should_ call a file.close() to make sure that the file is closed as a clean up procedure before releasing the object. I believe it does, but I tried your experiment with subclassing file and didn't ever see a call to close, so I can only a

Re: Questions about file object and close()

2004-12-09 Thread John Marshall
On Thu, 2004-12-09 at 08:41 -0500, Peter Hansen wrote: > John Marshall wrote: > > Hi, > > > > Does anyone see a problem with doing: > > data = file("tata").read() > > > > Each time this is done, I see a new file > > descriptor allocated (Linux) but not > > released. > > > > 1) Will there ev

Re: Questions about file object and close()

2004-12-09 Thread Peter Hansen
John Marshall wrote: Hi, Does anyone see a problem with doing: data = file("tata").read() Each time this is done, I see a new file descriptor allocated (Linux) but not released. 1) Will there ever be a point where I will have a problem with file descriptors because the garbage collecto