[issue14626] os module: use keyword-only arguments for dir_fd and nofollow to reduce function count

Serhiy Storchaka report at bugs.python.org
Fri Apr 20 08:52:54 CEST 2012


Serhiy Storchaka <storchaka at gmail.com> added the comment:

Before starting to code, it is necessary to solve the problem of interface.

With the majority of the functions all is good, but the `link` and `rename` have two `dirfd` parameters (even with different names). So I suggest two more alternatives.

One is the filename and dirfd are combined in a tuple. Instead of a tuple, you can specify only the name.

  link ((srcpath, srcdirfd), (dstpath, dstdirfd), *, followlinks=True)

The other -- `dirfd`s are combined in a tuple. You can specify a number, then `dirfd` is the same for both filenames.

  link (srcpath, dstpath, *, followlinks=True, dirfd=(srcdirfd, dstdirfd))

Which of these options (or the original, with different keywords) is preferable?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14626>
_______________________________________


More information about the Python-bugs-list mailing list