The opener parameter of Python 3 open() built-in
Christian Heimes
lists at cheimes.de
Mon Sep 3 09:29:05 EDT 2012
More information about the Python-list mailing list
Mon Sep 3 09:29:05 EDT 2012
- Previous message (by thread): The opener parameter of Python 3 open() built-in
- Next message (by thread): The opener parameter of Python 3 open() built-in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Am 03.09.2012 14:32, schrieb Marco:
> Does anyone have an example of utilisation?
The opener argument is a new 3.3 feature. For example you can use the
feature to implement exclusive creation of a file to avoid symlink attacks.
import os
def opener(file, flags):
return os.open(file, flags | os.O_EXCL)
open("newfile", "w", opener=opener)
- Previous message (by thread): The opener parameter of Python 3 open() built-in
- Next message (by thread): The opener parameter of Python 3 open() built-in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list