file.close()
Erik Max Francis
max at alcyone.com
Thu Jul 24 00:12:34 EDT 2003
Ben Finney wrote:
> It seems that nesting the 'try' clauses doesn't scale well. What if
> fifty files are opened? Must the nesting level of the 'try' clauses
> be
> fifty also, to close them promptly?
If you're manipulating fifty files in one block, presumably you're doing
so in a uniform way:
allFiles = [...]
try:
...
finally:
for eachFile in allFiles:
eachFile.close()
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ Man is a hating rather than a loving animal.
\__/ Rebecca West
More information about the Python-list
mailing list