In article <bk20ru$edg$01$1 at news.t-online.com>, Peter Otten <__peter__ at web.de> wrote: >Mel Wilson wrote: > >> In article <bjrtos$brd$03$1 at news.t-online.com>, >> Peter Otten <__peter__ at web.de> wrote: >>>(By the way, I think the __del__() method is superfluous) >> I wish it were, but no. The Python definition leaves the >> door open for implementations that garbage-collect only when >> they sorely need to, [ ... ] >> Rather say that logfile.__del__ is only half an answer. >I don't understand this. Where is the difference between delaying the >garbage collection of the logfile instance or its fh attribute? What I was thinking was, logfile eventually gets collected, and if it has the __del__ method as shown, the file will at least get closed then. Without the __del__ method, the file will(?) get collected eventually but maybe a long time after logfile. Not superfluous in terms of more functionality than is necessary .. superfluous in terms of more code than is used, I guess. >On implementations where immediate gc is not guaranteed, the only realistic >solution to avoid "dangling" open files would be to make the file closing >explicit: Very true. This is what I would call the whole answer. Regards. Mel.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4