Re: Open and closing files

2006-11-30 Thread [EMAIL PROTECTED]
John Machin wrote: > Thomas Ploch wrote: > > Is it defined behaviour that all files get implicitly closed when not > > assigning them? > > > > Like: > > > > def writeFile(fName, foo): > > open(fName, 'w').write(process(foo)) > > > > compared to: > > > > > > def writeFile(fName, foo): > > f

Re: Open and closing files

2006-11-30 Thread John Machin
Thomas Ploch wrote: > Is it defined behaviour that all files get implicitly closed when not > assigning them? > > Like: > > def writeFile(fName, foo): > open(fName, 'w').write(process(foo)) > > compared to: > > > def writeFile(fName, foo): > fileobj = open(fName, 'w') > fileobj.w

Open and closing files

2006-11-30 Thread Thomas Ploch
Is it defined behaviour that all files get implicitly closed when not assigning them? Like: def writeFile(fName, foo): open(fName, 'w').write(process(foo)) compared to: def writeFile(fName, foo): fileobj = open(fName, 'w') fileobj.write(process(foo)) fileobj.clo