The opener parameter of Python 3 open() built-in

Ben Finney ben+python at benfinney.id.au
Tue Sep 4 01:20:31 EDT 2012


Ben Finney <ben+python at benfinney.id.au> writes:

> So, having written the opener:
>
> > On Mon, 03 Sep 2012 15:29:05 +0200, Christian Heimes wrote:
> > > import os
> > > 
> > > def opener(file, flags):
> > >     return os.open(file, flags | os.O_EXCL)
>
> why not call that directly?
>
>     f = opener(file, flags)

Ah, because that returns the file descriptor, not the file. I see.

-- 
 \         “If nature has made any one thing less susceptible than all |
  `\    others of exclusive property, it is the action of the thinking |
_o__)              power called an idea” —Thomas Jefferson, 1813-08-13 |
Ben Finney



More information about the Python-list mailing list