@@ -13,38 +13,62 @@ \section{\module{stat} ---
1313complete details about the \cfunction {stat()}, \cfunction {fstat()} and
1414\cfunction {lstat()} calls, consult the documentation for your system.
1515
16- The \module {stat} module defines the following functions:
16+ The \module {stat} module defines the following functions to test for
17+ specific file types:
1718
1819
1920\begin {funcdesc }{S_ISDIR}{mode}
20- Return non-zero if the mode was gotten from a directory.
21+ Return non-zero if the mode is from a directory.
2122\end {funcdesc }
2223
2324\begin {funcdesc }{S_ISCHR}{mode}
24- Return non-zero if the mode was gotten from a character special device.
25+ Return non-zero if the mode is from a character special device file .
2526\end {funcdesc }
2627
2728\begin {funcdesc }{S_ISBLK}{mode}
28- Return non-zero if the mode was gotten from a block special device.
29+ Return non-zero if the mode is from a block special device file .
2930\end {funcdesc }
3031
3132\begin {funcdesc }{S_ISREG}{mode}
32- Return non-zero if the mode was gotten from a regular file.
33+ Return non-zero if the mode is from a regular file.
3334\end {funcdesc }
3435
3536\begin {funcdesc }{S_ISFIFO}{mode}
36- Return non-zero if the mode was gotten from a FIFO.
37+ Return non-zero if the mode is from a FIFO (named pipe) .
3738\end {funcdesc }
3839
3940\begin {funcdesc }{S_ISLNK}{mode}
40- Return non-zero if the mode was gotten from a symbolic link.
41+ Return non-zero if the mode is from a symbolic link.
4142\end {funcdesc }
4243
4344\begin {funcdesc }{S_ISSOCK}{mode}
44- Return non-zero if the mode was gotten from a socket.
45+ Return non-zero if the mode is from a socket.
4546\end {funcdesc }
4647
47- All the data items below are simply symbolic indexes into the 10-tuple
48+ Two additional functions are defined for more general manipulation of
49+ the file's mode:
50+
51+ \begin {funcdesc }{S_IMODE}{mode}
52+ Return the portion of the file's mode that can be set by
53+ \function {os.chmod()}---that is, the file's permission bits, plus the
54+ sticky bit, set-group-id, and set-user-id bits (on systems that support
55+ them).
56+ \end {funcdesc }
57+
58+ \begin {funcdesc }{S_IFMT}{mode}
59+ Return the portion of the file's mode that describes the file type (used
60+ by the \function {S_IS*()} functions above).
61+ \end {funcdesc }
62+
63+ Normally, you would use the \function {os.path.is*()} functions for
64+ testing the type of a file; the functions here are useful when you are
65+ doing multiple tests of the same file and wish to avoid the overhead of
66+ the \cfunction {stat()} system call for each test. These are also
67+ useful when checking for information about a file that isn't handled
68+ by \refmodule {os.path}, like the tests for block and character
69+ devices.
70+
71+ All the variables below are simply symbolic indexes into the 10-tuple
4872returned by \function {os.stat()}, \function {os.fstat()} or
4973\function {os.lstat()}.
5074
0 commit comments