homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients David.Townshend, Julian, amaury.forgeotdarc, benjamin.peterson, docs@python, neologix, pitrou, vstinner
Date 2011年08月24日.21:19:02
SpamBayes Score 0.00019761041
Marked as misclassified No
Message-id <1314220742.96.0.20537441288.issue12760@psf.upfronthosting.co.za>
In-reply-to
Content
> - os.open followed by os.fdopen is easy: it isn't that easy to get
> the incantation right (the pure Python open() in _pyio is 70 lines
> of code), especially if you want the file object to have the right
> "name" attribute
What if we can override the inner call to os.open()?
For example, io.open() could grow an additional argument "fd_opener" which defaults to the equivalent of os.open.
Then creation mode can be expressed like this:
 open(filename, 'w',
 fd_opener=lambda path, mode: os.open(path, mode|os.O_CREAT)
Another use case with openat (see #12797):
 open(filename,
 fd_opener=lambda path, mode: os.openat(fd, path, mode)
History
Date User Action Args
2011年08月24日 21:19:03amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, pitrou, vstinner, benjamin.peterson, neologix, docs@python, Julian, David.Townshend
2011年08月24日 21:19:02amaury.forgeotdarcsetmessageid: <1314220742.96.0.20537441288.issue12760@psf.upfronthosting.co.za>
2011年08月24日 21:19:02amaury.forgeotdarclinkissue12760 messages
2011年08月24日 21:19:02amaury.forgeotdarccreate

AltStyle によって変換されたページ (->オリジナル) /