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
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
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