[Python-ideas] Combining stat/lstat/fstatat etc.
storchaka at gmail.com
Fri Mar 16 23:05:40 CET 2012
16.03.12 02:48, Larry Hastings написав(ла):
> Guido steered me towards this suggestion. I think it's a fine idea. I'm
> in the process of adding keyword-only arguments to C extension argument
> parsing (issue #14328), and after that adding a new ns= parameter to
> os.utime (issue #14127). After that I may take a stab at this, unless
> you would prefer to be the implementor.
> Could you please create an issue on the bug tracker to discuss/track
> this? I'm happy to create the issue if you prefer.
With my bad English will be better if you create the issue. I will try to prepare a patch (it will be a big patch), when the syntax of the functions will become quite clear.
Initially, I assumed the following signatures:
access(path, mode, *, followlinks=True, dirfd=None, eaccess=False)
chmod(path, mode, *, followlinks=True, dirfd=None)
chown(path, uid, gid, *, followlinks=True, dirfd=None)
link(srcpath, dstpath, *, followlinks=True, srcdirfd=None, dstdirfd=None)
mkdir(path, mode=0o777, *, dirfd=None)
mknod(path, mode=0o600, device=0, *, dirfd=None)
open(path, flag, mode=0o777, *, dirfd=None)
readlink(path, *, dirfd=None)
rename(oldpath, newpath, *, olddirfd=None, newdirfd=None)
stat(path, *, followlinks=True, dirfd=None)
symlink(src, dst, *, dirfd=None)
unlink(path, *, removedir=False, dirfd=None)
utimes(path[, (atime, mtime)], *, ns=False, dirfd=None)
mkfifoat(path, mode=0o666, *, followlinks=True, dirfd=None)
But there is a nuisance with several dirfd in link and rename. The problem with naming parameters. Perhaps it would be better instead of using keyword parameter dirfd to pass tuple (dirfd, relpath) as path parameters?
The second question is how the user code will check the availability of dirfd functionality. Special global flags in os or sys?
More information about the Python-ideas