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
> Daniel Dittmar wrote:
> >- that suggest a different solution; like declarations on local
> >variables that say "call destructor when object goes out of scope"
I did not follow all of this thread (that precise subject reoccurs
once in a while, with some regularity), but I merely would like to
po
Daniel Dittmar wrote:
- that suggest a different solution; like declarations on local
variables that say "call destructor when object goes out of scope"
You may be interested in PEP 310 (reliable acquisition/release pairs):
http://www.python.org/peps/pep-0310.html
(Although if that idea gets ado
Timo Virkkala wrote:
Daniel Dittmar wrote:
And then there are a lot of people who think that changing all the
readlines one liner would be quite easy should the need of a Jython
port arrive, so why bother about it now?
The problem with this approach is, when the time for the Jython port
arrives,
Daniel Dittmar wrote:
And then there are a lot of people who think that changing all the
readlines one liner would be quite easy should the need of a Jython port
arrive, so why bother about it now?
The problem with this approach is, when the time for the Jython port
arrives, do you remember to d
Henrik Holm wrote:
I have recently started playing around with Python. Some of the things
I have done have involved reading files. The way I do this is along the
lines of
f = file('file.txt')
lines = f.readlines()
f.close()
I have noticed that it is possible to do this in one line:
lines
[EMAIL PROTECTED] (Henrik Holm) writes:
[+]
> I have recently started playing around with Python. Some of the things
> I have done have involved reading files. The way I do this is along the
> lines of
>
> f = file('file.txt')
> lines = f.readlines()
> f.close()
Verbose and readable. A
On Sun, 28 Nov 2004 18:59:31 -0600, [EMAIL PROTECTED] (Henrik Holm) wrote:
>I have recently started playing around with Python. Some of the things
> I have done have involved reading files. The way I do this is along the
> lines of
>
> [snip]
http://www.google.com/search?q=site%3Amail.python.
I have recently started playing around with Python. Some of the things
I have done have involved reading files. The way I do this is along the
lines of
f = file('file.txt')
lines = f.readlines()
f.close()
I have noticed that it is possible to do this in one line:
lines = file('file.txt
11 matches
Mail list logo