For D. Murray's suggestion---I think that we programmers have to learn
the idiom. We don't always control open, such as subprocess.Popen().
Thank you. I hope these thoughts help with issue 5513 and the related
questions to follow about complete removal of file in python3.
Opening the file in bin
En Sun, 22 Mar 2009 21:03:38 -0300, Scott David Daniels
escribió:
Gabriel Genellina wrote:
En Sun, 22 Mar 2009 19:12:13 -0300, Benjamin Peterson
escribió:
Gabriel Genellina yahoo.com.ar> writes:
The undocumented behavior is relying on the open() builtin to return a
BufferedReader for a bi
Gabriel Genellina wrote:
En Sun, 22 Mar 2009 19:12:13 -0300, Benjamin Peterson
escribió:
Gabriel Genellina yahoo.com.ar> writes:
The undocumented behavior is relying on the open() builtin to return a
BufferedReader for a binary file.
I don't see the problem. open() will return some Buffered
Return value of open undocumented?
The return value of open() is a "stream", according to
http://docs.python.org/dev/py3k/library/io.html#module-io
Seems like time for a bug report.
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel Genellina yahoo.com.ar> schrieb:
>
> How do you know? AFAIK, the return value of open() is completely
> undocumented:
> http://docs.python.org/3.0/library/functions.html#open
> And if you open the file in text mode, the return value isn't a
> BufferedIOBase.
Oh, I see. I should chan
En Sun, 22 Mar 2009 19:12:13 -0300, Benjamin Peterson
escribió:
Gabriel Genellina yahoo.com.ar> writes:
The undocumented behavior is relying on the open() builtin to return a
BufferedReader for a binary file.
I don't see the problem. open() will return some BufferedIOBase
implmentor, and
Gabriel Genellina yahoo.com.ar> writes:
>
> The undocumented behavior is relying on the open() builtin to return a
> BufferedReader for a binary file.
I don't see the problem. open() will return some BufferedIOBase implmentor, and
that's all that TextIOWrapper needs.
--
http://mail.python.
En Sun, 22 Mar 2009 16:37:31 -0300, Benjamin Peterson
escribió:
Gabriel Genellina yahoo.com.ar> writes:
There is another alternative that relies on undocumented behaviour: use
open to create a *binary* file and wrap the resulting BufferedReader
object in your own TextIOWrapper.
How is that
"Gabriel Genellina" wrote:
> En Sun, 22 Mar 2009 15:11:37 -0300, R. David Murray
> escribió:
> > "Gabriel Genellina" wrote:
> >> En Sat, 21 Mar 2009 23:58:07 -0300, escribió:
> >> >
> >> > class file(io.TextIOWrapper):
> >> >
> >> > '''
> >> > Enhance TextIO. Streams have many so
Gabriel Genellina yahoo.com.ar> writes:
>
> There is another alternative that relies on undocumented behaviour: use
> open to create a *binary* file and wrap the resulting BufferedReader
> object in your own TextIOWrapper.
How is that undocumented behavior? TextIOWrapper can wrap any buffer
En Sun, 22 Mar 2009 15:11:37 -0300, R. David Murray
escribió:
"Gabriel Genellina" wrote:
En Sat, 21 Mar 2009 23:58:07 -0300, escribió:
>
> class file(io.TextIOWrapper):
>
> '''
> Enhance TextIO. Streams have many sources,
> a file name is insufficient.
> '''
>
>
lamber...@corning.com wrote:
... Removing the comment character to increase the stream
reference count fixes the program, at the expense of
an extra TextIOWrapper object.
But you do create that extra TextIOWrapper, so there should
be no crying about its existence. If you rely on the d
"Gabriel Genellina" wrote:
> En Sat, 21 Mar 2009 23:58:07 -0300, escribió:
> > import re
> > import io
> >
> > class file(io.TextIOWrapper):
> >
> > '''
> > Enhance TextIO. Streams have many sources,
> > a file name is insufficient.
> > '''
> >
> > def __init__(self,s
corning.com> writes:
> Please, what is a better way to write the class with
> regard to this issue?
Set the original TextIOWrapper's buffer to None.
--
http://mail.python.org/mailman/listinfo/python-list
En Sat, 21 Mar 2009 23:58:07 -0300, escribió:
'''
A python 3 question.
Presume this code is in file p.py.
The program fails.
$ python3 p.py
...
ValueError: I/O operation on closed file.
Removing the comment character to increase the stream
reference
'''
A python 3 question.
Presume this code is in file p.py.
The program fails.
$ python3 p.py
...
ValueError: I/O operation on closed file.
Removing the comment character to increase the stream
reference count fixes the program, at the expense of
an
16 matches
Mail list logo