On 03.09.12 16:29, Christian Heimes wrote:
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.

Or you can use new dir_fd argument for same reason (or for performance).

for root, dirs, files, rootfd in os.fwalk(topdir):
    def opener(file, flags):
        return os.open(file, flags, dir_fd=rootfd)
    for name in files:
        with open(name, "r", opener=opener) as f:
            ...


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to