Python 2.0

Yukihiro Matsumoto matz at netlab.co.jp
Thu Jun 3 21:53:00 EDT 1999


"Gordon McMillan" <gmcm at hypernet.com> writes:

|As someone used to GC, you would probably never write:
|
| txt = open('blahbalh.txt','r').read()
|
|This is a common idiom for those of us used to ref counting.
|You would certainly take a reference to the file object so you could 
|explicitly close it. 

We often do that, at least in Ruby.  Ruby will close the file sometime
in the future.  To ensure immediate close of the file, you need to
close it explicitly in GC system.  Some may consider this as drawback,
though I don't.
						matz.




More information about the Python-list mailing list