open(False) in python3
Terry Reedy
tjreedy at udel.edu
Wed May 12 23:04:41 EDT 2010
On 5/12/2010 7:07 PM, Jan Kaliszewski wrote:
> Terry Reedy dixit (2010-05-12, 14:26):
>
>> On 5/12/2010 1:26 PM, Giampaolo Rodolà wrote:
>>> 2010/5/12 Gabriel Genellina<gagsl-py2 at yahoo.com.ar>:
>>>> open() in Python 3 does a lot of things; it's like a mix of codecs.open() +
>>>> builtin open() + os.fdopen() from 2.x all merged together. It does different
>>>> things depending on the type and quantity of its arguments, and even returns
>>>> objects of different types.
>>
>> The change actually happened, according to 'What's new', in 2.6 when
>> 'open' was made a synonym for the new io.open.
>
> It did happened in 3.0, not in 2.6.
I do not have 2.6 loaded to test and was judging from
What's New in Python 3.0 has a section
Changes Already Present In Python 2.6 which has an entry
"PEP 3116: New I/O Library. The io module is now the standard way of
doing file I/O, and the initial values of sys.stdin, sys.stdout and
sys.stderr are now instances of io.TextIOBase. The builtin open()
function is now an alias for io.open() "
The 2.6.5 doc says
"io.open(file[, mode[, buffering[, encoding[, errors[, newline[,
closefd=True]]]]]])¶
Open file and return a stream. If the file cannot be opened, an
IOError is raised.
file is either a string giving the name (and the path if the file
isn’t in the current working directory) of the file to be opened or a
file descriptor of the file to be opened. "
If you are right, then "The builtin open() function is now an alias for
io.open() " is misleading and does not apply to 2.6 even though it
appears in an entry on things backported to 2.6. I do not really care.
tjr
More information about the Python-list
mailing list