[Python-checkins] cpython: Fix #15148. Make the shutil.which docstring more thorough

brian.curtin python-checkins at python.org
Sat Jun 23 05:49:24 CEST 2012


http://hg.python.org/cpython/rev/5f18d9d34f73
changeset:   77609:5f18d9d34f73
user:        Brian Curtin <brian at python.org>
date:        Fri Jun 22 22:48:06 2012 -0500
summary:
  Fix #15148. Make the shutil.which docstring more thorough

files:
  Lib/shutil.py |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Lib/shutil.py b/Lib/shutil.py
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -973,7 +973,9 @@
 
 def which(cmd, mode=os.F_OK | os.X_OK, path=None):
     """Given a command, mode, and a path string, return the path which
-    conforms to the given mode on the path."""
+    conforms to the given mode on the PATH, or None if there is no such file.
+    `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of
+    os.environ.get("PATH"), or can be overridden with a custom search path."""
     # Check that a given file can be accessed with the correct mode.
     # Additionally check that `file` is not a directory, as on Windows
     # directories pass the os.access check.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list