Floris Bruynooghe <[EMAIL PROTECTED]>:
> I was wondering when it was worthwil to use context managers for
> file. Consider this example:
>
> def foo():
> t = False
> for line in file('/tmp/foo'):
> if line.startswith('bar'):
> t = True
> break
> return
On Jun 16, 8:24 am, Bruno Desthuilliers wrote:
>
> IIRC (please someone correct me if I'm wrong), proper release of file
> resources as soon as the file object gets out of scope is not garanteed
> in the language spec and is implementation dependant.
Right. Resources are freed in CPython right af
Floris Bruynooghe a écrit :
Hi
I was wondering when it was worthwil to use context managers for
file. Consider this example:
def foo():
t = False
for line in file('/tmp/foo'):
if line.startswith('bar'):
t = True
break
return t
What would the benefit
Hi
I was wondering when it was worthwil to use context managers for
file. Consider this example:
def foo():
t = False
for line in file('/tmp/foo'):
if line.startswith('bar'):
t = True
break
return t
What would the benefit of using a context manager be