open(False) in python3

Terry Reedy tjreedy at udel.edu
Wed May 12 14:26:54 EDT 2010


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.

>> In particular, open(some_integer) assumes some_integer is a file descriptor
>> and return some variant of file object using the given file descriptor.
>
> Interesting. I wasn't aware of this.
> Is it documented somewhere?

Right where it should be, in the entry for 'open' under 'built-in 
functions': "file is either ... or an integer file descriptor of the 
file to be wrapped"





More information about the Python-list mailing list