Clean up some markup cruft. A number of the macros that take no

parameters (like \UNIX) are commonly entered using an empty group to
separate the markup from a following inter-word space; this is not
needed when the next character is punctuation, or the markup is the
last thing in the enclosing group.  These cases were marked
inconsistently; the empty group is now *only* used when needed.
This commit is contained in:
Fred Drake 2001-11-28 07:26:15 +00:00
parent 00859c0538
commit c37b65ee10
40 changed files with 187 additions and 187 deletions

View File

@ -736,14 +736,14 @@ determination.
\begin{cfuncdesc}{PyObject*}{PySequence_Fast_GET_ITEM}{PyObject *o, int i} \begin{cfuncdesc}{PyObject*}{PySequence_Fast_GET_ITEM}{PyObject *o, int i}
Return the \var{i}th element of \var{o}, assuming that \var{o} was Return the \var{i}th element of \var{o}, assuming that \var{o} was
returned by \cfunction{PySequence_Fast()}, \var{o} is not \NULL{}, returned by \cfunction{PySequence_Fast()}, \var{o} is not \NULL,
and that \var{i} is within bounds. and that \var{i} is within bounds.
\end{cfuncdesc} \end{cfuncdesc}
\begin{cfuncdesc}{int}{PySequence_Fast_GET_SIZE}{PyObject *o} \begin{cfuncdesc}{int}{PySequence_Fast_GET_SIZE}{PyObject *o}
Returns the length of \var{o}, assuming that \var{o} was Returns the length of \var{o}, assuming that \var{o} was
returned by \cfunction{PySequence_Fast()} and that \var{o} is returned by \cfunction{PySequence_Fast()} and that \var{o} is
not \NULL{}. The size can also be gotten by calling not \NULL. The size can also be gotten by calling
\cfunction{PySequence_Size()} on \var{o}, but \cfunction{PySequence_Size()} on \var{o}, but
\cfunction{PySequence_Fast_GET_SIZE()} is faster because it can \cfunction{PySequence_Fast_GET_SIZE()} is faster because it can
assume \var{o} is a list or tuple. assume \var{o} is a list or tuple.

View File

@ -3,7 +3,7 @@
The Application Programmer's Interface to Python gives C and The Application Programmer's Interface to Python gives C and
\Cpp{} programmers access to the Python interpreter at a variety of \Cpp{} programmers access to the Python interpreter at a variety of
levels. The API is equally usable from \Cpp{}, but for brevity it is levels. The API is equally usable from \Cpp, but for brevity it is
generally referred to as the Python/C API. There are two generally referred to as the Python/C API. There are two
fundamentally different reasons for using the Python/C API. The first fundamentally different reasons for using the Python/C API. The first
reason is to write \emph{extension modules} for specific purposes; reason is to write \emph{extension modules} for specific purposes;

View File

@ -272,14 +272,14 @@ application to Python.
% (what to watch out for) % (what to watch out for)
\section{Embedding Python in \Cpp{} \section{Embedding Python in \Cpp
\label{embeddingInCplusplus}} \label{embeddingInCplusplus}}
It is also possible to embed Python in a \Cpp{} program; precisely how this It is also possible to embed Python in a \Cpp{} program; precisely how this
is done will depend on the details of the \Cpp{} system used; in general you is done will depend on the details of the \Cpp{} system used; in general you
will need to write the main program in \Cpp{}, and use the \Cpp{} compiler will need to write the main program in \Cpp, and use the \Cpp{} compiler
to compile and link your program. There is no need to recompile Python to compile and link your program. There is no need to recompile Python
itself using \Cpp{}. itself using \Cpp.
\section{Linking Requirements \section{Linking Requirements

View File

@ -1,4 +1,4 @@
\chapter{Extending Python with C or \Cpp{} \label{intro}} \chapter{Extending Python with C or \Cpp \label{intro}}
It is quite easy to add new built-in modules to Python, if you know It is quite easy to add new built-in modules to Python, if you know
@ -499,14 +499,14 @@ This function must be registered with the interpreter using the
\constant{METH_VARARGS} flag; this is described in section \constant{METH_VARARGS} flag; this is described in section
\ref{methodTable}, ``The Module's Method Table and Initialization \ref{methodTable}, ``The Module's Method Table and Initialization
Function.'' The \cfunction{PyArg_ParseTuple()} function and its Function.'' The \cfunction{PyArg_ParseTuple()} function and its
arguments are documented in section \ref{parseTuple}, ``Extracting arguments are documented in section~\ref{parseTuple}, ``Extracting
Parameters in Extension Functions.'' Parameters in Extension Functions.''
The macros \cfunction{Py_XINCREF()} and \cfunction{Py_XDECREF()} The macros \cfunction{Py_XINCREF()} and \cfunction{Py_XDECREF()}
increment/decrement the reference count of an object and are safe in increment/decrement the reference count of an object and are safe in
the presence of \NULL{} pointers (but note that \var{temp} will not be the presence of \NULL{} pointers (but note that \var{temp} will not be
\NULL{} in this context). More info on them in section \NULL{} in this context). More info on them in
\ref{refcounts}, ``Reference Counts.'' section~\ref{refcounts}, ``Reference Counts.''
Later, when it is time to call the function, you call the C function Later, when it is time to call the function, you call the C function
\cfunction{PyEval_CallObject()}. This function has two arguments, both \cfunction{PyEval_CallObject()}. This function has two arguments, both
@ -544,7 +544,7 @@ global variable, you should somehow \cfunction{Py_DECREF()} the result,
even (especially!) if you are not interested in its value. even (especially!) if you are not interested in its value.
Before you do this, however, it is important to check that the return Before you do this, however, it is important to check that the return
value isn't \NULL{}. If it is, the Python function terminated by value isn't \NULL. If it is, the Python function terminated by
raising an exception. If the C code that called raising an exception. If the C code that called
\cfunction{PyEval_CallObject()} is called from Python, it should now \cfunction{PyEval_CallObject()} is called from Python, it should now
return an error indication to its Python caller, so the interpreter return an error indication to its Python caller, so the interpreter
@ -652,7 +652,7 @@ representation.
\item[\samp{z} (string or \code{None}) {[char *]}] \item[\samp{z} (string or \code{None}) {[char *]}]
Like \samp{s}, but the Python object may also be \code{None}, in which Like \samp{s}, but the Python object may also be \code{None}, in which
case the C pointer is set to \NULL{}. case the C pointer is set to \NULL.
\item[\samp{z\#} (string or \code{None} or any read buffer compatible object) \item[\samp{z\#} (string or \code{None} or any read buffer compatible object)
{[char *, int]}] {[char *, int]}]
@ -680,7 +680,7 @@ first one a pointer to an encoding name string (\var{encoding}), and the
second a pointer to a pointer to a character buffer (\var{**buffer}, second a pointer to a pointer to a character buffer (\var{**buffer},
the buffer used for storing the encoded data). the buffer used for storing the encoded data).
The encoding name must map to a registered codec. If set to \NULL{}, The encoding name must map to a registered codec. If set to \NULL,
the default encoding is used. the default encoding is used.
\cfunction{PyArg_ParseTuple()} will allocate a buffer of the needed \cfunction{PyArg_ParseTuple()} will allocate a buffer of the needed
@ -705,7 +705,7 @@ pointer to a character buffer (\var{**buffer}, the buffer used for
storing the encoded data) and the third one a pointer to an integer storing the encoded data) and the third one a pointer to an integer
(\var{*buffer_length}, the buffer length). (\var{*buffer_length}, the buffer length).
The encoding name must map to a registered codec. If set to \NULL{}, The encoding name must map to a registered codec. If set to \NULL,
the default encoding is used. the default encoding is used.
There are two modes of operation: There are two modes of operation:
@ -766,7 +766,7 @@ Convert a Python complex number to a C \ctype{Py_complex} structure.
Store a Python object (without any conversion) in a C object pointer. Store a Python object (without any conversion) in a C object pointer.
The C program thus receives the actual object that was passed. The The C program thus receives the actual object that was passed. The
object's reference count is not increased. The pointer stored is not object's reference count is not increased. The pointer stored is not
\NULL{}. \NULL.
\item[\samp{O!} (object) {[\var{typeobject}, PyObject *]}] \item[\samp{O!} (object) {[\var{typeobject}, PyObject *]}]
Store a Python object in a C object pointer. This is similar to Store a Python object in a C object pointer. This is similar to
@ -945,7 +945,7 @@ int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,
The \var{arg} and \var{format} parameters are identical to those of the The \var{arg} and \var{format} parameters are identical to those of the
\cfunction{PyArg_ParseTuple()} function. The \var{kwdict} parameter \cfunction{PyArg_ParseTuple()} function. The \var{kwdict} parameter
is the dictionary of keywords received as the third parameter from the is the dictionary of keywords received as the third parameter from the
Python runtime. The \var{kwlist} parameter is a \NULL{}-terminated Python runtime. The \var{kwlist} parameter is a \NULL-terminated
list of strings which identify the parameters; the names are matched list of strings which identify the parameters; the names are matched
with the type information from \var{format} from left to right. On with the type information from \var{format} from left to right. On
success, \cfunction{PyArg_ParseTupleAndKeywords()} returns true, success, \cfunction{PyArg_ParseTupleAndKeywords()} returns true,
@ -1055,11 +1055,11 @@ used to make long format strings a tad more readable.
\item[\samp{s} (string) {[char *]}] \item[\samp{s} (string) {[char *]}]
Convert a null-terminated C string to a Python object. If the C Convert a null-terminated C string to a Python object. If the C
string pointer is \NULL{}, \code{None} is used. string pointer is \NULL, \code{None} is used.
\item[\samp{s\#} (string) {[char *, int]}] \item[\samp{s\#} (string) {[char *, int]}]
Convert a C string and its length to a Python object. If the C string Convert a C string and its length to a Python object. If the C string
pointer is \NULL{}, the length is ignored and \code{None} is pointer is \NULL, the length is ignored and \code{None} is
returned. returned.
\item[\samp{z} (string or \code{None}) {[char *]}] \item[\samp{z} (string or \code{None}) {[char *]}]
@ -1171,10 +1171,10 @@ Examples (to the left the call, to the right the resulting Python value):
\section{Reference Counts \section{Reference Counts
\label{refcounts}} \label{refcounts}}
In languages like C or \Cpp{}, the programmer is responsible for In languages like C or \Cpp, the programmer is responsible for
dynamic allocation and deallocation of memory on the heap. In C, dynamic allocation and deallocation of memory on the heap. In C,
this is done using the functions \cfunction{malloc()} and this is done using the functions \cfunction{malloc()} and
\cfunction{free()}. In \Cpp{}, the operators \keyword{new} and \cfunction{free()}. In \Cpp, the operators \keyword{new} and
\keyword{delete} are used with essentially the same meaning; they are \keyword{delete} are used with essentially the same meaning; they are
actually implemented using \cfunction{malloc()} and actually implemented using \cfunction{malloc()} and
\cfunction{free()}, so we'll restrict the following discussion to the \cfunction{free()}, so we'll restrict the following discussion to the
@ -1423,7 +1423,7 @@ cause later core dumps) if you do so. Functions that return object
references generally return \NULL{} only to indicate that an references generally return \NULL{} only to indicate that an
exception occurred. The reason for not testing for \NULL{} exception occurred. The reason for not testing for \NULL{}
arguments is that functions often pass the objects they receive on to arguments is that functions often pass the objects they receive on to
other function --- if each function were to test for \NULL{}, other function --- if each function were to test for \NULL,
there would be a lot of redundant tests and the code would run more there would be a lot of redundant tests and the code would run more
slowly. slowly.
@ -1458,10 +1458,10 @@ the Python user.
% description. % description.
\section{Writing Extensions in \Cpp{} \section{Writing Extensions in \Cpp
\label{cplusplus}} \label{cplusplus}}
It is possible to write extension modules in \Cpp{}. Some restrictions It is possible to write extension modules in \Cpp. Some restrictions
apply. If the main program (the Python interpreter) is compiled and apply. If the main program (the Python interpreter) is compiled and
linked by the C compiler, global or static objects with constructors linked by the C compiler, global or static objects with constructors
cannot be used. This is not a problem if the main program is linked cannot be used. This is not a problem if the main program is linked

View File

@ -13,7 +13,7 @@ custom interpreters. The make file make file builds a make file
that reflects various system variables determined by configure when that reflects various system variables determined by configure when
the Python interpreter was built, so people building module's don't the Python interpreter was built, so people building module's don't
have to resupply these settings. This vastly simplifies the process have to resupply these settings. This vastly simplifies the process
of building extensions and custom interpreters on Unix systems. of building extensions and custom interpreters on \UNIX{} systems.
The make file make file is distributed as the file The make file make file is distributed as the file
\file{Misc/Makefile.pre.in} in the Python source distribution. The \file{Misc/Makefile.pre.in} in the Python source distribution. The

View File

@ -3,7 +3,7 @@
This chapter briefly explains how to create a Windows extension module This chapter briefly explains how to create a Windows extension module
for Python using Microsoft Visual \Cpp{}, and follows with more for Python using Microsoft Visual \Cpp, and follows with more
detailed background information on how it works. The explanatory detailed background information on how it works. The explanatory
material is useful for both the Windows programmer learning to build material is useful for both the Windows programmer learning to build
Python extensions and the \UNIX{} programmer interested in producing Python extensions and the \UNIX{} programmer interested in producing
@ -66,7 +66,7 @@ on why you must do this.
loading of code. Before you try to build a module that can be loading of code. Before you try to build a module that can be
dynamically loaded, be aware of how your system works. dynamically loaded, be aware of how your system works.
In \UNIX{}, a shared object (\file{.so}) file contains code to be used by the In \UNIX, a shared object (\file{.so}) file contains code to be used by the
program, and also the names of functions and data that it expects to program, and also the names of functions and data that it expects to
find in the program. When the file is joined to the program, all find in the program. When the file is joined to the program, all
references to those functions and data in the file's code are changed references to those functions and data in the file's code are changed
@ -80,7 +80,7 @@ to refer to the program's memory; instead, the code already uses the
DLL's lookup table, and the lookup table is modified at runtime to DLL's lookup table, and the lookup table is modified at runtime to
point to the functions and data. point to the functions and data.
In \UNIX{}, there is only one type of library file (\file{.a}) which In \UNIX, there is only one type of library file (\file{.a}) which
contains code from several object files (\file{.o}). During the link contains code from several object files (\file{.o}). During the link
step to create a shared object file (\file{.so}), the linker may find step to create a shared object file (\file{.so}), the linker may find
that it doesn't know where an identifier is defined. The linker will that it doesn't know where an identifier is defined. The linker will
@ -99,7 +99,7 @@ an import library may be generated, which will need to be used for all
future DLLs that depend on the symbols in the application or DLL. future DLLs that depend on the symbols in the application or DLL.
Suppose you are building two dynamic-load modules, B and C, which should Suppose you are building two dynamic-load modules, B and C, which should
share another block of code A. On \UNIX{}, you would \emph{not} pass share another block of code A. On \UNIX, you would \emph{not} pass
\file{A.a} to the linker for \file{B.so} and \file{C.so}; that would \file{A.a} to the linker for \file{B.so} and \file{C.so}; that would
cause it to be included twice, so that B and C would each have their cause it to be included twice, so that B and C would each have their
own copy. In Windows, building \file{A.dll} will also build own copy. In Windows, building \file{A.dll} will also build
@ -109,14 +109,14 @@ which will be used at runtime to access A's code.
In Windows, using an import library is sort of like using \samp{import In Windows, using an import library is sort of like using \samp{import
spam}; it gives you access to spam's names, but does not create a spam}; it gives you access to spam's names, but does not create a
separate copy. On \UNIX{}, linking with a library is more like separate copy. On \UNIX, linking with a library is more like
\samp{from spam import *}; it does create a separate copy. \samp{from spam import *}; it does create a separate copy.
\section{Using DLLs in Practice \label{win-dlls}} \section{Using DLLs in Practice \label{win-dlls}}
\sectionauthor{Chris Phoenix}{cphoenix@best.com} \sectionauthor{Chris Phoenix}{cphoenix@best.com}
Windows Python is built in Microsoft Visual \Cpp{}; using other Windows Python is built in Microsoft Visual \Cpp; using other
compilers may or may not work (though Borland seems to). The rest of compilers may or may not work (though Borland seems to). The rest of
this section is MSV\Cpp{} specific. this section is MSV\Cpp{} specific.

View File

@ -123,7 +123,7 @@ Returns the standard info string of the object.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{tod_gettime}{} \begin{funcdesc}{tod_gettime}{}
Returns the time (in seconds since the Epoch, in UCT, as for \POSIX{}) from Returns the time (in seconds since the Epoch, in UCT, as for \POSIX) from
a time server. a time server.
\end{funcdesc} \end{funcdesc}

View File

@ -56,7 +56,7 @@ newline (\code{'\e n'}), a newline will be added. This causes
\begin{seealso} \begin{seealso}
\seemodule{binascii}{Support module containing \ASCII{}-to-binary \seemodule{binascii}{Support module containing \ASCII-to-binary
and binary-to-\ASCII{} conversions.} and binary-to-\ASCII{} conversions.}
\seerfc{1521}{MIME (Multipurpose Internet Mail Extensions) Part One: \seerfc{1521}{MIME (Multipurpose Internet Mail Extensions) Part One:
Mechanisms for Specifying and Describing the Format of Mechanisms for Specifying and Describing the Format of

View File

@ -1,5 +1,5 @@
\section{\module{binascii} --- \section{\module{binascii} ---
Convert between binary and \ASCII{}} Convert between binary and \ASCII}
\declaremodule{builtin}{binascii} \declaremodule{builtin}{binascii}
\modulesynopsis{Tools for converting between binary and various \modulesynopsis{Tools for converting between binary and various
@ -7,7 +7,7 @@
The \module{binascii} module contains a number of methods to convert The \module{binascii} module contains a number of methods to convert
between binary and various \ASCII{}-encoded binary between binary and various \ASCII-encoded binary
representations. Normally, you will not use these functions directly representations. Normally, you will not use these functions directly
but use wrapper modules like \refmodule{uu}\refstmodindex{uu} or but use wrapper modules like \refmodule{uu}\refstmodindex{uu} or
\refmodule{binhex}\refstmodindex{binhex} instead, this module solely \refmodule{binhex}\refstmodindex{binhex} instead, this module solely

View File

@ -6,7 +6,7 @@
This module encodes and decodes files in binhex4 format, a format This module encodes and decodes files in binhex4 format, a format
allowing representation of Macintosh files in \ASCII{}. On the Macintosh, allowing representation of Macintosh files in \ASCII. On the Macintosh,
both forks of a file and the finder information are encoded (or both forks of a file and the finder information are encoded (or
decoded), on other platforms only the data fork is handled. decoded), on other platforms only the data fork is handled.

View File

@ -86,7 +86,7 @@ be generated is platform-dependent.
\begin{funcdesc}{timegm}{tuple} \begin{funcdesc}{timegm}{tuple}
An unrelated but handy function that takes a time tuple such as An unrelated but handy function that takes a time tuple such as
returned by the \function{gmtime()} function in the \refmodule{time} returned by the \function{gmtime()} function in the \refmodule{time}
module, and returns the corresponding Unix timestamp value, assuming module, and returns the corresponding \UNIX{} timestamp value, assuming
an epoch of 1970, and the POSIX encoding. In fact, an epoch of 1970, and the POSIX encoding. In fact,
\function{time.gmtime()} and \function{timegm()} are each others' inverse. \function{time.gmtime()} and \function{timegm()} are each others' inverse.
\end{funcdesc} \end{funcdesc}

View File

@ -405,7 +405,7 @@ to a shell command, you should make sure the string contains only
alphanumeric characters, dashes, underscores, and periods. alphanumeric characters, dashes, underscores, and periods.
\subsection{Installing your CGI script on a Unix system} \subsection{Installing your CGI script on a \UNIX\ system}
Read the documentation for your HTTP server and check with your local Read the documentation for your HTTP server and check with your local
system administrator to find the directory where CGI scripts should be system administrator to find the directory where CGI scripts should be

View File

@ -150,7 +150,7 @@ De-initialize the library, and return terminal to normal status.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{erasechar}{} \begin{funcdesc}{erasechar}{}
Returns the user's current erase character. Under Unix operating Returns the user's current erase character. Under \UNIX{} operating
systems this is a property of the controlling tty of the curses systems this is a property of the controlling tty of the curses
program, and is not set by the curses library itself. program, and is not set by the curses library itself.
\end{funcdesc} \end{funcdesc}
@ -284,7 +284,7 @@ prefix `M-' followed by the name of the corresponding ASCII character.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{killchar}{} \begin{funcdesc}{killchar}{}
Returns the user's current line kill character. Under Unix operating Returns the user's current line kill character. Under \UNIX{} operating
systems this is a property of the controlling tty of the curses systems this is a property of the controlling tty of the curses
program, and is not set by the curses library itself. program, and is not set by the curses library itself.
\end{funcdesc} \end{funcdesc}

View File

@ -87,7 +87,7 @@ is useful in code like:
Call the function named \var{name} in the referenced shared object. Call the function named \var{name} in the referenced shared object.
The arguments must be either Python integers, which will be The arguments must be either Python integers, which will be
passed as is, Python strings, to which a pointer will be passed, passed as is, Python strings, to which a pointer will be passed,
or \code{None}, which will be passed as \NULL{}. Note that or \code{None}, which will be passed as \NULL. Note that
strings should only be passed to functions as \ctype{const char*}, as strings should only be passed to functions as \ctype{const char*}, as
Python will not like its string mutated. Python will not like its string mutated.

View File

@ -136,11 +136,11 @@ Raised when an \keyword{assert} statement fails.
\begin{excdesc}{EOFError} \begin{excdesc}{EOFError}
% XXXJH xrefs here % XXXJH xrefs here
Raised when one of the built-in functions (\function{input()} or Raised when one of the built-in functions (\function{input()} or
\function{raw_input()}) hits an end-of-file condition (\EOF{}) without \function{raw_input()}) hits an end-of-file condition (\EOF) without
reading any data. reading any data.
% XXXJH xrefs here % XXXJH xrefs here
(N.B.: the \method{read()} and \method{readline()} methods of file (N.B.: the \method{read()} and \method{readline()} methods of file
objects return an empty string when they hit \EOF{}.) objects return an empty string when they hit \EOF.)
\end{excdesc} \end{excdesc}
\begin{excdesc}{FloatingPointError} \begin{excdesc}{FloatingPointError}

View File

@ -6,8 +6,8 @@
\modulesynopsis{The \function{fcntl()} and \function{ioctl()} system calls.} \modulesynopsis{The \function{fcntl()} and \function{ioctl()} system calls.}
\sectionauthor{Jaap Vermeulen}{} \sectionauthor{Jaap Vermeulen}{}
\indexii{UNIX@\UNIX{}}{file control} \indexii{UNIX@\UNIX}{file control}
\indexii{UNIX@\UNIX{}}{I/O control} \indexii{UNIX@\UNIX}{I/O control}
This module performs file control and I/O control on file descriptors. This module performs file control and I/O control on file descriptors.
It is an interface to the \cfunction{fcntl()} and \cfunction{ioctl()} It is an interface to the \cfunction{fcntl()} and \cfunction{ioctl()}

View File

@ -19,7 +19,7 @@ characters used in shell-style wildcards are:
\lineii{[!\var{seq}]}{matches any character not in \var{seq}} \lineii{[!\var{seq}]}{matches any character not in \var{seq}}
\end{tableii} \end{tableii}
Note that the filename separator (\code{'/'} on \UNIX{}) is \emph{not} Note that the filename separator (\code{'/'} on \UNIX) is \emph{not}
special to this module. See module special to this module. See module
\refmodule{glob}\refstmodindex{glob} for pathname expansion \refmodule{glob}\refstmodindex{glob} for pathname expansion
(\refmodule{glob} uses \function{fnmatch()} to match pathname (\refmodule{glob} uses \function{fnmatch()} to match pathname

View File

@ -15,13 +15,13 @@ The \module{getpass} module provides two functions:
Prompt the user for a password without echoing. The user is Prompt the user for a password without echoing. The user is
prompted using the string \var{prompt}, which defaults to prompted using the string \var{prompt}, which defaults to
\code{'Password: '}. \code{'Password: '}.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getuser}{} \begin{funcdesc}{getuser}{}
Return the ``login name'' of the user. Return the ``login name'' of the user.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
This function checks the environment variables \envvar{LOGNAME}, This function checks the environment variables \envvar{LOGNAME},
\envvar{USER}, \envvar{LNAME} and \envvar{USERNAME}, in order, and \envvar{USER}, \envvar{LNAME} and \envvar{USERNAME}, in order, and

View File

@ -6,7 +6,7 @@
This module defines a number of classes that allow easy and uniform This module defines a number of classes that allow easy and uniform
access to mail messages in a (\UNIX{}) mailbox. access to mail messages in a (\UNIX) mailbox.
\begin{classdesc}{UnixMailbox}{fp\optional{, factory}} \begin{classdesc}{UnixMailbox}{fp\optional{, factory}}
Access to a classic \UNIX-style mailbox, where all messages are Access to a classic \UNIX-style mailbox, where all messages are

View File

@ -2,7 +2,7 @@
Memory-mapped file support} Memory-mapped file support}
\declaremodule{builtin}{mmap} \declaremodule{builtin}{mmap}
\modulesynopsis{Interface to memory-mapped files for Unix and Windows.} \modulesynopsis{Interface to memory-mapped files for \UNIX\ and Windows.}
Memory-mapped file objects behave like both mutable strings and like Memory-mapped file objects behave like both mutable strings and like
file objects. You can use mmap objects in most places where strings file objects. You can use mmap objects in most places where strings

View File

@ -111,67 +111,67 @@ These functions are described in ``Files and Directories'' (section
\begin{funcdesc}{ctermid}{} \begin{funcdesc}{ctermid}{}
Return the filename corresponding to the controlling terminal of the Return the filename corresponding to the controlling terminal of the
process. process.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getegid}{} \begin{funcdesc}{getegid}{}
Return the current process' effective group id. Return the current process' effective group id.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{geteuid}{} \begin{funcdesc}{geteuid}{}
\index{user!effective id} \index{user!effective id}
Return the current process' effective user id. Return the current process' effective user id.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getgid}{} \begin{funcdesc}{getgid}{}
\index{process!group} \index{process!group}
Return the current process' group id. Return the current process' group id.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getgroups}{} \begin{funcdesc}{getgroups}{}
Return list of supplemental group ids associated with the current Return list of supplemental group ids associated with the current
process. process.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getlogin}{} \begin{funcdesc}{getlogin}{}
Return the actual login name for the current process, even if there Return the actual login name for the current process, even if there
are multiple login names which map to the same user id. are multiple login names which map to the same user id.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getpgrp}{} \begin{funcdesc}{getpgrp}{}
\index{process!group} \index{process!group}
Return the current process group id. Return the current process group id.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getpid}{} \begin{funcdesc}{getpid}{}
\index{process!id} \index{process!id}
Return the current process id. Return the current process id.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getppid}{} \begin{funcdesc}{getppid}{}
\index{process!id of parent} \index{process!id of parent}
Return the parent's process id. Return the parent's process id.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getuid}{} \begin{funcdesc}{getuid}{}
\index{user!id} \index{user!id}
Return the current process' user id. Return the current process' user id.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getenv}{varname\optional{, value}} \begin{funcdesc}{getenv}{varname\optional{, value}}
Return the value of the environment variable \var{varname} if it Return the value of the environment variable \var{varname} if it
exists, or \var{value} if it doesn't. \var{value} defaults to exists, or \var{value} if it doesn't. \var{value} defaults to
\code{None}. \code{None}.
Availability: most flavors of \UNIX{}, Windows. Availability: most flavors of \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{putenv}{varname, value} \begin{funcdesc}{putenv}{varname, value}
@ -180,7 +180,7 @@ Set the environment variable named \var{varname} to the string
\var{value}. Such changes to the environment affect subprocesses \var{value}. Such changes to the environment affect subprocesses
started with \function{os.system()}, \function{popen()} or started with \function{os.system()}, \function{popen()} or
\function{fork()} and \function{execv()}. \function{fork()} and \function{execv()}.
Availability: most flavors of \UNIX{}, Windows. Availability: most flavors of \UNIX, Windows.
When \function{putenv()} is When \function{putenv()} is
supported, assignments to items in \code{os.environ} are automatically supported, assignments to items in \code{os.environ} are automatically
@ -191,17 +191,17 @@ actually preferable to assign to items of \code{os.environ}.
\begin{funcdesc}{setegid}{egid} \begin{funcdesc}{setegid}{egid}
Set the current process's effective group id. Set the current process's effective group id.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{seteuid}{euid} \begin{funcdesc}{seteuid}{euid}
Set the current process's effective user id. Set the current process's effective user id.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{setgid}{gid} \begin{funcdesc}{setgid}{gid}
Set the current process' group id. Set the current process' group id.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{setgroups}{groups} \begin{funcdesc}{setgroups}{groups}
@ -209,7 +209,7 @@ Set the list of supplemental group ids associated with the current
process to \var{groups}. \var{groups} must be a sequence, and each process to \var{groups}. \var{groups} must be a sequence, and each
element must be an integer identifying a group. This operation is element must be an integer identifying a group. This operation is
typical available only to the superuser. typical available only to the superuser.
Availability: \UNIX{}. Availability: \UNIX.
\versionadded{2.2} \versionadded{2.2}
\end{funcdesc} \end{funcdesc}
@ -217,47 +217,47 @@ Availability: \UNIX{}.
Calls the system call \cfunction{setpgrp()} or \cfunction{setpgrp(0, Calls the system call \cfunction{setpgrp()} or \cfunction{setpgrp(0,
0)} depending on which version is implemented (if any). See the 0)} depending on which version is implemented (if any). See the
\UNIX{} manual for the semantics. \UNIX{} manual for the semantics.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{setpgid}{pid, pgrp} \begin{funcdesc}{setpgid}{pid, pgrp}
Calls the system call \cfunction{setpgid()}. See the \UNIX{} manual Calls the system call \cfunction{setpgid()}. See the \UNIX{} manual
for the semantics. for the semantics.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{setreuid}{ruid, euid} \begin{funcdesc}{setreuid}{ruid, euid}
Set the current process's real and effective user ids. Set the current process's real and effective user ids.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{setregid}{rgid, egid} \begin{funcdesc}{setregid}{rgid, egid}
Set the current process's real and effective group ids. Set the current process's real and effective group ids.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{setsid}{} \begin{funcdesc}{setsid}{}
Calls the system call \cfunction{setsid()}. See the \UNIX{} manual Calls the system call \cfunction{setsid()}. See the \UNIX{} manual
for the semantics. for the semantics.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{setuid}{uid} \begin{funcdesc}{setuid}{uid}
\index{user!id, setting} \index{user!id, setting}
Set the current process' user id. Set the current process' user id.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
% placed in this section since it relates to errno.... a little weak ;-( % placed in this section since it relates to errno.... a little weak ;-(
\begin{funcdesc}{strerror}{code} \begin{funcdesc}{strerror}{code}
Return the error message corresponding to the error code in Return the error message corresponding to the error code in
\var{code}. \var{code}.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{umask}{mask} \begin{funcdesc}{umask}{mask}
Set the current numeric umask and returns the previous umask. Set the current numeric umask and returns the previous umask.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{uname}{} \begin{funcdesc}{uname}{}
@ -271,7 +271,7 @@ hostname is \function{socket.gethostname()}
or even or even
\withsubitem{(in module socket)}{\ttindex{gethostbyaddr()}} \withsubitem{(in module socket)}{\ttindex{gethostbyaddr()}}
\code{socket.gethostbyaddr(socket.gethostname())}. \code{socket.gethostbyaddr(socket.gethostname())}.
Availability: recent flavors of \UNIX{}. Availability: recent flavors of \UNIX.
\end{funcdesc} \end{funcdesc}
@ -287,7 +287,7 @@ Return an open file object connected to the file descriptor \var{fd}.
The \var{mode} and \var{bufsize} arguments have the same meaning as The \var{mode} and \var{bufsize} arguments have the same meaning as
the corresponding arguments to the built-in \function{open()} the corresponding arguments to the built-in \function{open()}
function. function.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{popen}{command\optional{, mode\optional{, bufsize}}} \begin{funcdesc}{popen}{command\optional{, mode\optional{, bufsize}}}
@ -300,7 +300,7 @@ the command (encoded in the format specified for \function{wait()}) is
available as the return value of the \method{close()} method of the file available as the return value of the \method{close()} method of the file
object, except that when the exit status is zero (termination without object, except that when the exit status is zero (termination without
errors), \code{None} is returned. errors), \code{None} is returned.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\versionchanged[This function worked unreliably under Windows in \versionchanged[This function worked unreliably under Windows in
earlier versions of Python. This was due to the use of the earlier versions of Python. This was due to the use of the
@ -313,7 +313,7 @@ Availability: \UNIX{}, Windows.
Return a new file object opened in update mode (\samp{w+}). The file Return a new file object opened in update mode (\samp{w+}). The file
has no directory entries associated with it and will be automatically has no directory entries associated with it and will be automatically
deleted once there are no file descriptors for the file. deleted once there are no file descriptors for the file.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
@ -333,21 +333,21 @@ module; these are only available on \UNIX.
\begin{funcdesc}{popen2}{cmd\optional{, mode\optional{, bufsize}}} \begin{funcdesc}{popen2}{cmd\optional{, mode\optional{, bufsize}}}
Executes \var{cmd} as a sub-process. Returns the file objects Executes \var{cmd} as a sub-process. Returns the file objects
\code{(\var{child_stdin}, \var{child_stdout})}. \code{(\var{child_stdin}, \var{child_stdout})}.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\versionadded{2.0} \versionadded{2.0}
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{popen3}{cmd\optional{, mode\optional{, bufsize}}} \begin{funcdesc}{popen3}{cmd\optional{, mode\optional{, bufsize}}}
Executes \var{cmd} as a sub-process. Returns the file objects Executes \var{cmd} as a sub-process. Returns the file objects
\code{(\var{child_stdin}, \var{child_stdout}, \var{child_stderr})}. \code{(\var{child_stdin}, \var{child_stdout}, \var{child_stderr})}.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\versionadded{2.0} \versionadded{2.0}
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{popen4}{cmd\optional{, mode\optional{, bufsize}}} \begin{funcdesc}{popen4}{cmd\optional{, mode\optional{, bufsize}}}
Executes \var{cmd} as a sub-process. Returns the file objects Executes \var{cmd} as a sub-process. Returns the file objects
\code{(\var{child_stdin}, \var{child_stdout_and_stderr})}. \code{(\var{child_stdin}, \var{child_stdout_and_stderr})}.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\versionadded{2.0} \versionadded{2.0}
\end{funcdesc} \end{funcdesc}
@ -364,7 +364,7 @@ using file descriptors.
\begin{funcdesc}{close}{fd} \begin{funcdesc}{close}{fd}
Close file descriptor \var{fd}. Close file descriptor \var{fd}.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
Note: this function is intended for low-level I/O and must be applied Note: this function is intended for low-level I/O and must be applied
to a file descriptor as returned by \function{open()} or to a file descriptor as returned by \function{open()} or
@ -375,26 +375,26 @@ built-in function \function{open()} or by \function{popen()} or
\begin{funcdesc}{dup}{fd} \begin{funcdesc}{dup}{fd}
Return a duplicate of file descriptor \var{fd}. Return a duplicate of file descriptor \var{fd}.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{dup2}{fd, fd2} \begin{funcdesc}{dup2}{fd, fd2}
Duplicate file descriptor \var{fd} to \var{fd2}, closing the latter Duplicate file descriptor \var{fd} to \var{fd2}, closing the latter
first if necessary. first if necessary.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{fpathconf}{fd, name} \begin{funcdesc}{fpathconf}{fd, name}
Return system configuration information relevant to an open file. Return system configuration information relevant to an open file.
\var{name} specifies the configuration value to retrieve; it may be a \var{name} specifies the configuration value to retrieve; it may be a
string which is the name of a defined system value; these names are string which is the name of a defined system value; these names are
specified in a number of standards (\POSIX.1, Unix95, Unix98, and specified in a number of standards (\POSIX.1, \UNIX 95, \UNIX 98, and
others). Some platforms define additional names as well. The names others). Some platforms define additional names as well. The names
known to the host operating system are given in the known to the host operating system are given in the
\code{pathconf_names} dictionary. For configuration variables not \code{pathconf_names} dictionary. For configuration variables not
included in that mapping, passing an integer for \var{name} is also included in that mapping, passing an integer for \var{name} is also
accepted. accepted.
Availability: \UNIX{}. Availability: \UNIX.
If \var{name} is a string and is not known, \exception{ValueError} is If \var{name} is a string and is not known, \exception{ValueError} is
raised. If a specific value for \var{name} is not supported by the raised. If a specific value for \var{name} is not supported by the
@ -405,25 +405,25 @@ error number.
\begin{funcdesc}{fstat}{fd} \begin{funcdesc}{fstat}{fd}
Return status for file descriptor \var{fd}, like \function{stat()}. Return status for file descriptor \var{fd}, like \function{stat()}.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{fstatvfs}{fd} \begin{funcdesc}{fstatvfs}{fd}
Return information about the filesystem containing the file associated Return information about the filesystem containing the file associated
with file descriptor \var{fd}, like \function{statvfs()}. with file descriptor \var{fd}, like \function{statvfs()}.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{ftruncate}{fd, length} \begin{funcdesc}{ftruncate}{fd, length}
Truncate the file corresponding to file descriptor \var{fd}, Truncate the file corresponding to file descriptor \var{fd},
so that it is at most \var{length} bytes in size. so that it is at most \var{length} bytes in size.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{isatty}{fd} \begin{funcdesc}{isatty}{fd}
Return \code{1} if the file descriptor \var{fd} is open and connected to a Return \code{1} if the file descriptor \var{fd} is open and connected to a
tty(-like) device, else \code{0}. tty(-like) device, else \code{0}.
Availability: \UNIX{} Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{lseek}{fd, pos, how} \begin{funcdesc}{lseek}{fd, pos, how}
@ -432,7 +432,7 @@ Set the current position of file descriptor \var{fd} to position
relative to the beginning of the file; \code{1} to set it relative to relative to the beginning of the file; \code{1} to set it relative to
the current position; \code{2} to set it relative to the end of the the current position; \code{2} to set it relative to the end of the
file. file.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{open}{file, flags\optional{, mode}} \begin{funcdesc}{open}{file, flags\optional{, mode}}
@ -441,7 +441,7 @@ Open the file \var{file} and set various flags according to
The default \var{mode} is \code{0777} (octal), and the current umask The default \var{mode} is \code{0777} (octal), and the current umask
value is first masked out. Return the file descriptor for the newly value is first masked out. Return the file descriptor for the newly
opened file. opened file.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
For a description of the flag and mode values, see the C run-time For a description of the flag and mode values, see the C run-time
documentation; flag constants (like \constant{O_RDONLY} and documentation; flag constants (like \constant{O_RDONLY} and
@ -458,19 +458,19 @@ Open a new pseudo-terminal pair. Return a pair of file descriptors
\code{(\var{master}, \var{slave})} for the pty and the tty, \code{(\var{master}, \var{slave})} for the pty and the tty,
respectively. For a (slightly) more portable approach, use the respectively. For a (slightly) more portable approach, use the
\refmodule{pty}\refstmodindex{pty} module. \refmodule{pty}\refstmodindex{pty} module.
Availability: Some flavors of \UNIX{} Availability: Some flavors of \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{pipe}{} \begin{funcdesc}{pipe}{}
Create a pipe. Return a pair of file descriptors \code{(\var{r}, Create a pipe. Return a pair of file descriptors \code{(\var{r},
\var{w})} usable for reading and writing, respectively. \var{w})} usable for reading and writing, respectively.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{read}{fd, n} \begin{funcdesc}{read}{fd, n}
Read at most \var{n} bytes from file descriptor \var{fd}. Read at most \var{n} bytes from file descriptor \var{fd}.
Return a string containing the bytes read. Return a string containing the bytes read.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
Note: this function is intended for low-level I/O and must be applied Note: this function is intended for low-level I/O and must be applied
to a file descriptor as returned by \function{open()} or to a file descriptor as returned by \function{open()} or
@ -483,27 +483,27 @@ built-in function \function{open()} or by \function{popen()} or
\begin{funcdesc}{tcgetpgrp}{fd} \begin{funcdesc}{tcgetpgrp}{fd}
Return the process group associated with the terminal given by Return the process group associated with the terminal given by
\var{fd} (an open file descriptor as returned by \function{open()}). \var{fd} (an open file descriptor as returned by \function{open()}).
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{tcsetpgrp}{fd, pg} \begin{funcdesc}{tcsetpgrp}{fd, pg}
Set the process group associated with the terminal given by Set the process group associated with the terminal given by
\var{fd} (an open file descriptor as returned by \function{open()}) \var{fd} (an open file descriptor as returned by \function{open()})
to \var{pg}. to \var{pg}.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{ttyname}{fd} \begin{funcdesc}{ttyname}{fd}
Return a string which specifies the terminal device associated with Return a string which specifies the terminal device associated with
file-descriptor \var{fd}. If \var{fd} is not associated with a terminal file-descriptor \var{fd}. If \var{fd} is not associated with a terminal
device, an exception is raised. device, an exception is raised.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{write}{fd, str} \begin{funcdesc}{write}{fd, str}
Write the string \var{str} to file descriptor \var{fd}. Write the string \var{str} to file descriptor \var{fd}.
Return the number of bytes actually written. Return the number of bytes actually written.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
Note: this function is intended for low-level I/O and must be applied Note: this function is intended for low-level I/O and must be applied
to a file descriptor as returned by \function{open()} or to a file descriptor as returned by \function{open()} or
@ -532,7 +532,7 @@ The following data items are available for use in constructing the
\dataline{O_TRUNC} \dataline{O_TRUNC}
Options for the \var{flag} argument to the \function{open()} function. Options for the \var{flag} argument to the \function{open()} function.
These can be bit-wise OR'd together. These can be bit-wise OR'd together.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{datadesc} \end{datadesc}
\begin{datadesc}{O_BINARY} \begin{datadesc}{O_BINARY}
@ -552,7 +552,7 @@ existence of \var{path}, or it can be the inclusive OR of one or more
of \constant{R_OK}, \constant{W_OK}, and \constant{X_OK} to test of \constant{R_OK}, \constant{W_OK}, and \constant{X_OK} to test
permissions. Return \code{1} if access is allowed, \code{0} if not. permissions. Return \code{1} if access is allowed, \code{0} if not.
See the \UNIX{} man page \manpage{access}{2} for more information. See the \UNIX{} man page \manpage{access}{2} for more information.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{datadesc}{F_OK} \begin{datadesc}{F_OK}
@ -578,34 +578,34 @@ Availability: \UNIX{}, Windows.
\begin{funcdesc}{chdir}{path} \begin{funcdesc}{chdir}{path}
\index{directory!changing} \index{directory!changing}
Change the current working directory to \var{path}. Change the current working directory to \var{path}.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getcwd}{} \begin{funcdesc}{getcwd}{}
Return a string representing the current working directory. Return a string representing the current working directory.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{chroot}{path} \begin{funcdesc}{chroot}{path}
Change the root directory of the current process to \var{path}. Change the root directory of the current process to \var{path}.
Availability: \UNIX{}. Availability: \UNIX.
\versionadded{2.2} \versionadded{2.2}
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{chmod}{path, mode} \begin{funcdesc}{chmod}{path, mode}
Change the mode of \var{path} to the numeric \var{mode}. Change the mode of \var{path} to the numeric \var{mode}.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{chown}{path, uid, gid} \begin{funcdesc}{chown}{path, uid, gid}
Change the owner and group id of \var{path} to the numeric \var{uid} Change the owner and group id of \var{path} to the numeric \var{uid}
and \var{gid}. and \var{gid}.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{link}{src, dst} \begin{funcdesc}{link}{src, dst}
Create a hard link pointing to \var{src} named \var{dst}. Create a hard link pointing to \var{src} named \var{dst}.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{listdir}{path} \begin{funcdesc}{listdir}{path}
@ -613,19 +613,19 @@ Return a list containing the names of the entries in the directory.
The list is in arbitrary order. It does not include the special The list is in arbitrary order. It does not include the special
entries \code{'.'} and \code{'..'} even if they are present in the entries \code{'.'} and \code{'..'} even if they are present in the
directory. directory.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{lstat}{path} \begin{funcdesc}{lstat}{path}
Like \function{stat()}, but do not follow symbolic links. Like \function{stat()}, but do not follow symbolic links.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{mkfifo}{path\optional{, mode}} \begin{funcdesc}{mkfifo}{path\optional{, mode}}
Create a FIFO (a named pipe) named \var{path} with numeric mode Create a FIFO (a named pipe) named \var{path} with numeric mode
\var{mode}. The default \var{mode} is \code{0666} (octal). The current \var{mode}. The default \var{mode} is \code{0666} (octal). The current
umask value is first masked out from the mode. umask value is first masked out from the mode.
Availability: \UNIX{}. Availability: \UNIX.
FIFOs are pipes that can be accessed like regular files. FIFOs exist FIFOs are pipes that can be accessed like regular files. FIFOs exist
until they are deleted (for example with \function{os.unlink()}). until they are deleted (for example with \function{os.unlink()}).
@ -640,7 +640,7 @@ Create a directory named \var{path} with numeric mode \var{mode}.
The default \var{mode} is \code{0777} (octal). On some systems, The default \var{mode} is \code{0777} (octal). On some systems,
\var{mode} is ignored. Where it is used, the current umask value is \var{mode} is ignored. Where it is used, the current umask value is
first masked out. first masked out.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{makedirs}{path\optional{, mode}} \begin{funcdesc}{makedirs}{path\optional{, mode}}
@ -664,7 +664,7 @@ known to the host operating system are given in the
\code{pathconf_names} dictionary. For configuration variables not \code{pathconf_names} dictionary. For configuration variables not
included in that mapping, passing an integer for \var{name} is also included in that mapping, passing an integer for \var{name} is also
accepted. accepted.
Availability: \UNIX{}. Availability: \UNIX.
If \var{name} is a string and is not known, \exception{ValueError} is If \var{name} is a string and is not known, \exception{ValueError} is
raised. If a specific value for \var{name} is not supported by the raised. If a specific value for \var{name} is not supported by the
@ -686,7 +686,7 @@ Return a string representing the path to which the symbolic link
points. The result may be either an absolute or relative pathname; if points. The result may be either an absolute or relative pathname; if
it is relative, it may be converted to an absolute pathname using it is relative, it may be converted to an absolute pathname using
\code{os.path.join(os.path.dirname(\var{path}), \var{result})}. \code{os.path.join(os.path.dirname(\var{path}), \var{result})}.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{remove}{path} \begin{funcdesc}{remove}{path}
@ -697,7 +697,7 @@ documented below. On Windows, attempting to remove a file that is in
use causes an exception to be raised; on \UNIX, the directory entry is use causes an exception to be raised; on \UNIX, the directory entry is
removed but the storage allocated to the file is not made available removed but the storage allocated to the file is not made available
until the original file is no longer in use. until the original file is no longer in use.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{removedirs}{path} \begin{funcdesc}{removedirs}{path}
@ -723,7 +723,7 @@ successful, the renaming will be an atomic operation (this is a
\exception{OSError} will be raised even if it is a file; there may be \exception{OSError} will be raised even if it is a file; there may be
no way to implement an atomic rename when \var{dst} names an existing no way to implement an atomic rename when \var{dst} names an existing
file. file.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{renames}{old, new} \begin{funcdesc}{renames}{old, new}
@ -740,7 +740,7 @@ you lack permissions needed to remove the leaf directory or file.
\begin{funcdesc}{rmdir}{path} \begin{funcdesc}{rmdir}{path}
Remove the directory \var{path}. Remove the directory \var{path}.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{stat}{path} \begin{funcdesc}{stat}{path}
@ -762,7 +762,7 @@ More items may be added at the end by some implementations. Note that
on the Mac OS, the time values are floating point values, like all on the Mac OS, the time values are floating point values, like all
time values on the Mac OS. time values on the Mac OS.
(On Windows, some items are filled with dummy values.) (On Windows, some items are filled with dummy values.)
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
Note: The standard module \refmodule{stat}\refstmodindex{stat} defines Note: The standard module \refmodule{stat}\refstmodindex{stat} defines
functions and constants that are useful for extracting information functions and constants that are useful for extracting information
@ -783,7 +783,7 @@ members of the \ctype{statvfs} structure, in the order
\code{f_favail}, \code{f_favail},
\code{f_flag}, \code{f_flag},
\code{f_namemax}. \code{f_namemax}.
Availability: \UNIX{}. Availability: \UNIX.
Note: The standard module \module{statvfs}\refstmodindex{statvfs} Note: The standard module \module{statvfs}\refstmodindex{statvfs}
defines constants that are useful for extracting information defines constants that are useful for extracting information
@ -792,7 +792,7 @@ from a \ctype{statvfs} structure.
\begin{funcdesc}{symlink}{src, dst} \begin{funcdesc}{symlink}{src, dst}
Create a symbolic link pointing to \var{src} named \var{dst}. Create a symbolic link pointing to \var{src} named \var{dst}.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{tempnam}{\optional{dir\optional{, prefix}}} \begin{funcdesc}{tempnam}{\optional{dir\optional{, prefix}}}
@ -830,7 +830,7 @@ generate before reusing names.
Remove the file \var{path}. This is the same function as Remove the file \var{path}. This is the same function as
\function{remove()}; the \function{unlink()} name is its traditional \function{remove()}; the \function{unlink()} name is its traditional
\UNIX{} name. \UNIX{} name.
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{utime}{path, times} \begin{funcdesc}{utime}{path, times}
@ -840,7 +840,7 @@ times are set to the current time. Otherwise, \var{times} must be a
2-tuple of numbers, of the form \code{(\var{atime}, \var{mtime})} 2-tuple of numbers, of the form \code{(\var{atime}, \var{mtime})}
which is used to set the access and modified times, respectively. which is used to set the access and modified times, respectively.
\versionchanged[Added support for \code{None} for \var{times}]{2.0} \versionchanged[Added support for \code{None} for \var{times}]{2.0}
Availability: Macintosh, \UNIX{}, Windows. Availability: Macintosh, \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
@ -916,7 +916,7 @@ Availability: \UNIX, Windows.
\begin{funcdesc}{_exit}{n} \begin{funcdesc}{_exit}{n}
Exit to the system with status \var{n}, without calling cleanup Exit to the system with status \var{n}, without calling cleanup
handlers, flushing stdio buffers, etc. handlers, flushing stdio buffers, etc.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
Note: the standard way to exit is \code{sys.exit(\var{n})}. Note: the standard way to exit is \code{sys.exit(\var{n})}.
\function{_exit()} should normally only be used in the child process \function{_exit()} should normally only be used in the child process
@ -926,7 +926,7 @@ after a \function{fork()}.
\begin{funcdesc}{fork}{} \begin{funcdesc}{fork}{}
Fork a child process. Return \code{0} in the child, the child's Fork a child process. Return \code{0} in the child, the child's
process id in the parent. process id in the parent.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{forkpty}{} \begin{funcdesc}{forkpty}{}
@ -936,26 +936,26 @@ where \var{pid} is \code{0} in the child, the new child's process id
in the parent, and \code{fd} is the file descriptor of the master end in the parent, and \code{fd} is the file descriptor of the master end
of the pseudo-terminal. For a more portable approach, use the of the pseudo-terminal. For a more portable approach, use the
\refmodule{pty} module. \refmodule{pty} module.
Availability: Some flavors of \UNIX{} Availability: Some flavors of \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{kill}{pid, sig} \begin{funcdesc}{kill}{pid, sig}
\index{process!killing} \index{process!killing}
\index{process!signalling} \index{process!signalling}
Kill the process \var{pid} with signal \var{sig}. Kill the process \var{pid} with signal \var{sig}.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{nice}{increment} \begin{funcdesc}{nice}{increment}
Add \var{increment} to the process's ``niceness''. Return the new Add \var{increment} to the process's ``niceness''. Return the new
niceness. niceness.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{plock}{op} \begin{funcdesc}{plock}{op}
Lock program segments into memory. The value of \var{op} Lock program segments into memory. The value of \var{op}
(defined in \code{<sys/lock.h>}) determines which segments are locked. (defined in \code{<sys/lock.h>}) determines which segments are locked.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdescni}{popen}{\unspecified} \begin{funcdescni}{popen}{\unspecified}
@ -1033,7 +1033,7 @@ Possible values for the \var{mode} parameter to the \function{spawn*()}
family of functions. If either of these values is given, the family of functions. If either of these values is given, the
\function{spawn*()} functions will return as soon as the new process \function{spawn*()} functions will return as soon as the new process
has been created, with the process ID as the return value. has been created, with the process ID as the return value.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\versionadded{1.6} \versionadded{1.6}
\end{datadesc} \end{datadesc}
@ -1044,7 +1044,7 @@ family of functions. If this is given as \var{mode}, the
has run to completion and will return the exit code of the process the has run to completion and will return the exit code of the process the
run is successful, or \code{-\var{signal}} if a signal kills the run is successful, or \code{-\var{signal}} if a signal kills the
process. process.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\versionadded{1.6} \versionadded{1.6}
\end{datadesc} \end{datadesc}
@ -1090,7 +1090,7 @@ format specified for \function{wait()}, except on Windows 95 and 98,
where it is always \code{0}. Note that \POSIX{} does not specify the where it is always \code{0}. Note that \POSIX{} does not specify the
meaning of the return value of the C \cfunction{system()} function, meaning of the return value of the C \cfunction{system()} function,
so the return value of the Python function is system-dependent. so the return value of the Python function is system-dependent.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{times}{} \begin{funcdesc}{times}{}
@ -1101,7 +1101,7 @@ user time, children's system time, and elapsed real time since a fixed
point in the past, in that order. See the \UNIX{} manual page point in the past, in that order. See the \UNIX{} manual page
\manpage{times}{2} or the corresponding Windows Platform API \manpage{times}{2} or the corresponding Windows Platform API
documentation. documentation.
Availability: \UNIX{}, Windows. Availability: \UNIX, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{wait}{} \begin{funcdesc}{wait}{}
@ -1110,7 +1110,7 @@ its pid and exit status indication: a 16-bit number, whose low byte is
the signal number that killed the process, and whose high byte is the the signal number that killed the process, and whose high byte is the
exit status (if the signal number is zero); the high bit of the low exit status (if the signal number is zero); the high bit of the low
byte is set if a core file was produced. byte is set if a core file was produced.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{waitpid}{pid, options} \begin{funcdesc}{waitpid}{pid, options}
@ -1119,7 +1119,7 @@ and return a tuple containing its process id and exit status
indication (encoded as for \function{wait()}). The semantics of the indication (encoded as for \function{wait()}). The semantics of the
call are affected by the value of the integer \var{options}, which call are affected by the value of the integer \var{options}, which
should be \code{0} for normal operation. should be \code{0} for normal operation.
Availability: \UNIX{}. Availability: \UNIX.
If \var{pid} is greater than \code{0}, \function{waitpid()} requests If \var{pid} is greater than \code{0}, \function{waitpid()} requests
status information for that specific process. If \var{pid} is status information for that specific process. If \var{pid} is
@ -1133,7 +1133,7 @@ group \code{-\var{pid}} (the absolute value of \var{pid}).
\begin{datadesc}{WNOHANG} \begin{datadesc}{WNOHANG}
The option for \function{waitpid()} to avoid hanging if no child The option for \function{waitpid()} to avoid hanging if no child
process status is available immediately. process status is available immediately.
Availability: \UNIX{}. Availability: \UNIX.
\end{datadesc} \end{datadesc}
The following functions take a process status code as returned by The following functions take a process status code as returned by
@ -1143,35 +1143,35 @@ process.
\begin{funcdesc}{WIFSTOPPED}{status} \begin{funcdesc}{WIFSTOPPED}{status}
Return true if the process has been stopped. Return true if the process has been stopped.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{WIFSIGNALED}{status} \begin{funcdesc}{WIFSIGNALED}{status}
Return true if the process exited due to a signal. Return true if the process exited due to a signal.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{WIFEXITED}{status} \begin{funcdesc}{WIFEXITED}{status}
Return true if the process exited using the \manpage{exit}{2} system Return true if the process exited using the \manpage{exit}{2} system
call. call.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{WEXITSTATUS}{status} \begin{funcdesc}{WEXITSTATUS}{status}
If \code{WIFEXITED(\var{status})} is true, return the integer If \code{WIFEXITED(\var{status})} is true, return the integer
parameter to the \manpage{exit}{2} system call. Otherwise, the return parameter to the \manpage{exit}{2} system call. Otherwise, the return
value is meaningless. value is meaningless.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{WSTOPSIG}{status} \begin{funcdesc}{WSTOPSIG}{status}
Return the signal which caused the process to stop. Return the signal which caused the process to stop.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{WTERMSIG}{status} \begin{funcdesc}{WTERMSIG}{status}
Return the signal which caused the process to exit. Return the signal which caused the process to exit.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
@ -1188,7 +1188,7 @@ known to the host operating system are given in the
\code{confstr_names} dictionary. For configuration variables not \code{confstr_names} dictionary. For configuration variables not
included in that mapping, passing an integer for \var{name} is also included in that mapping, passing an integer for \var{name} is also
accepted. accepted.
Availability: \UNIX{}. Availability: \UNIX.
If the configuration value specified by \var{name} isn't defined, the If the configuration value specified by \var{name} isn't defined, the
empty string is returned. empty string is returned.
@ -1214,7 +1214,7 @@ If the configuration value specified by \var{name} isn't defined,
parameter for \function{confstr()} apply here as well; the dictionary parameter for \function{confstr()} apply here as well; the dictionary
that provides information on the known names is given by that provides information on the known names is given by
\code{sysconf_names}. \code{sysconf_names}.
Availability: \UNIX{}. Availability: \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{datadesc}{sysconf_names} \begin{datadesc}{sysconf_names}

View File

@ -13,7 +13,7 @@ disguised \UNIX{} interface).
\strong{Do not import this module directly.} Instead, import the \strong{Do not import this module directly.} Instead, import the
module \refmodule{os}, which provides a \emph{portable} version of this module \refmodule{os}, which provides a \emph{portable} version of this
interface. On \UNIX{}, the \refmodule{os} module provides a superset of interface. On \UNIX, the \refmodule{os} module provides a superset of
the \module{posix} interface. On non-\UNIX{} operating systems the the \module{posix} interface. On non-\UNIX{} operating systems the
\module{posix} module is not available, but a subset is always \module{posix} module is not available, but a subset is always
available through the \refmodule{os} interface. Once \refmodule{os} is available through the \refmodule{os} interface. Once \refmodule{os} is

View File

@ -9,7 +9,7 @@
\sectionauthor{Jaap Vermeulen}{} \sectionauthor{Jaap Vermeulen}{}
\indexii{\POSIX{}}{file object} \indexii{\POSIX}{file object}
\deprecated{1.5}{The locking operation that this module provides is \deprecated{1.5}{The locking operation that this module provides is
done better and more portably by the done better and more portably by the
@ -22,7 +22,7 @@ the file flags, and an easy interface to duplicate the file object.
The module defines a new file object, the posixfile object. It The module defines a new file object, the posixfile object. It
has all the standard file object methods and adds the methods has all the standard file object methods and adds the methods
described below. This module only works for certain flavors of described below. This module only works for certain flavors of
\UNIX{}, since it uses \function{fcntl.fcntl()} for file locking.% \UNIX, since it uses \function{fcntl.fcntl()} for file locking.%
\withsubitem{(in module fcntl)}{\ttindex{fcntl()}} \withsubitem{(in module fcntl)}{\ttindex{fcntl()}}
To instantiate a posixfile object, use the \function{open()} function To instantiate a posixfile object, use the \function{open()} function

View File

@ -127,7 +127,7 @@ inserted between components, unless \var{path} is empty.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{normcase}{path} \begin{funcdesc}{normcase}{path}
Normalize the case of a pathname. On \UNIX{}, this returns the path Normalize the case of a pathname. On \UNIX, this returns the path
unchanged; on case-insensitive filesystems, it converts the path to unchanged; on case-insensitive filesystems, it converts the path to
lowercase. On Windows, it also converts forward slashes to backward lowercase. On Windows, it also converts forward slashes to backward
slashes. slashes.
@ -144,7 +144,7 @@ forward slashes to backward slashes.
\begin{funcdesc}{realpath}{path} \begin{funcdesc}{realpath}{path}
Return the canonical path of the specified filename, eliminating any Return the canonical path of the specified filename, eliminating any
symbolic links encountered in the path. symbolic links encountered in the path.
Availability: \UNIX{}. Availability: \UNIX.
\versionadded{2.2} \versionadded{2.2}
\end{funcdesc} \end{funcdesc}
@ -153,14 +153,14 @@ Return true if both pathname arguments refer to the same file or
directory (as indicated by device number and i-node number). directory (as indicated by device number and i-node number).
Raise an exception if a \function{os.stat()} call on either pathname Raise an exception if a \function{os.stat()} call on either pathname
fails. fails.
Availability: Macintosh, \UNIX{}. Availability: Macintosh, \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{sameopenfile}{fp1, fp2} \begin{funcdesc}{sameopenfile}{fp1, fp2}
Return true if the file objects \var{fp1} and \var{fp2} refer to the Return true if the file objects \var{fp1} and \var{fp2} refer to the
same file. The two file objects may represent different file same file. The two file objects may represent different file
descriptors. descriptors.
Availability: Macintosh, \UNIX{}. Availability: Macintosh, \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{samestat}{stat1, stat2} \begin{funcdesc}{samestat}{stat1, stat2}
@ -169,7 +169,7 @@ the same file. These structures may have been returned by
\function{fstat()}, \function{lstat()}, or \function{stat()}. This \function{fstat()}, \function{lstat()}, or \function{stat()}. This
function implements the underlying comparison used by function implements the underlying comparison used by
\function{samefile()} and \function{sameopenfile()}. \function{samefile()} and \function{sameopenfile()}.
Availability: Macintosh, \UNIX{}. Availability: Macintosh, \UNIX.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{split}{path} \begin{funcdesc}{split}{path}

View File

@ -9,7 +9,7 @@ This module provides access to the \cfunction{select()}
and \cfunction{poll()} functions and \cfunction{poll()} functions
available in most operating systems. Note that on Windows, it only available in most operating systems. Note that on Windows, it only
works for sockets; on other operating systems, it also works for other works for sockets; on other operating systems, it also works for other
file types (in particular, on \UNIX{}, it works on pipes). It cannot file types (in particular, on \UNIX, it works on pipes). It cannot
be used on regular files to determine whether a file has grown since be used on regular files to determine whether a file has grown since
it was last read. it was last read.
@ -67,7 +67,7 @@ desciptors that don't originate from WinSock.}
\subsection{Polling Objects \subsection{Polling Objects
\label{poll-objects}} \label{poll-objects}}
The \cfunction{poll()} system call, supported on most Unix systems, The \cfunction{poll()} system call, supported on most \UNIX{} systems,
provides better scalability for network servers that service many, provides better scalability for network servers that service many,
many clients at the same time. many clients at the same time.
\cfunction{poll()} scales better because the system call only \cfunction{poll()} scales better because the system call only

View File

@ -20,7 +20,7 @@ tail part. For the head part, it uses \code{sys.prefix} and
\code{sys.exec_prefix}; empty heads are skipped. For \code{sys.exec_prefix}; empty heads are skipped. For
the tail part, it uses the empty string (on Macintosh or Windows) or the tail part, it uses the empty string (on Macintosh or Windows) or
it uses first \file{lib/python\shortversion/site-packages} and then it uses first \file{lib/python\shortversion/site-packages} and then
\file{lib/site-python} (on \UNIX{}). For each of the distinct \file{lib/site-python} (on \UNIX). For each of the distinct
head-tail combinations, it sees if it refers to an existing directory, head-tail combinations, it sees if it refers to an existing directory,
and if so, adds to \code{sys.path}, and also inspects the path for and if so, adds to \code{sys.path}, and also inspects the path for
configuration files. configuration files.

View File

@ -115,10 +115,10 @@ Time of last status change (see manual pages for details).
The interpretation of ``file size'' changes according to the file The interpretation of ``file size'' changes according to the file
type. For plain files this is the size of the file in bytes. For type. For plain files this is the size of the file in bytes. For
FIFOs and sockets under most Unixes (including Linux in particular), FIFOs and sockets under most flavors of \UNIX{} (including Linux in
the ``size'' is the number of bytes waiting to be read at the time of particular), the ``size'' is the number of bytes waiting to be read at
the call to \function{os.stat()}, \function{os.fstat()}, or the time of the call to \function{os.stat()}, \function{os.fstat()},
\function{os.lstat()}; this can sometimes be useful, especially for or \function{os.lstat()}; this can sometimes be useful, especially for
polling one of these special files after a non-blocking open. The polling one of these special files after a non-blocking open. The
meaning of the size field for other character and block devices varies meaning of the size field for other character and block devices varies
more, depending on the implementation of the underlying system call. more, depending on the implementation of the underlying system call.

View File

@ -128,7 +128,7 @@ Notes:
\code{<>} and \code{!=} are alternate spellings for the same operator. \code{<>} and \code{!=} are alternate spellings for the same operator.
(I couldn't choose between \ABC{} and C! :-) (I couldn't choose between \ABC{} and C! :-)
\index{ABC language@\ABC{} language} \index{ABC language@\ABC{} language}
\index{language!ABC@\ABC{}} \index{language!ABC@\ABC}
\indexii{C}{language} \indexii{C}{language}
\code{!=} is the preferred spelling; \code{<>} is obsolescent. \code{!=} is the preferred spelling; \code{<>} is obsolescent.
@ -1105,7 +1105,7 @@ Files have the following methods:
\begin{methoddesc}[file]{readlines}{\optional{sizehint}} \begin{methoddesc}[file]{readlines}{\optional{sizehint}}
Read until \EOF{} using \method{readline()} and return a list containing Read until \EOF{} using \method{readline()} and return a list containing
the lines thus read. If the optional \var{sizehint} argument is the lines thus read. If the optional \var{sizehint} argument is
present, instead of reading up to \EOF{}, whole lines totalling present, instead of reading up to \EOF, whole lines totalling
approximately \var{sizehint} bytes (possibly after rounding up to an approximately \var{sizehint} bytes (possibly after rounding up to an
internal buffer size) are read. Objects implementing a file-like internal buffer size) are read. Objects implementing a file-like
interface may choose to ignore \var{sizehint} if it cannot be interface may choose to ignore \var{sizehint} if it cannot be

View File

@ -156,7 +156,7 @@ It is always available.
the like. Most systems require it to be in the range 0-127, and the like. Most systems require it to be in the range 0-127, and
produce undefined results otherwise. Some systems have a convention produce undefined results otherwise. Some systems have a convention
for assigning specific meanings to specific exit codes, but these for assigning specific meanings to specific exit codes, but these
are generally underdeveloped; Unix programs generally use 2 for are generally underdeveloped; \UNIX{} programs generally use 2 for
command line syntax errors and 1 for all other kind of errors. If command line syntax errors and 1 for all other kind of errors. If
another type of object is passed, \code{None} is equivalent to another type of object is passed, \code{None} is equivalent to
passing zero, and any other object is printed to \code{sys.stderr} passing zero, and any other object is printed to \code{sys.stderr}

View File

@ -55,7 +55,7 @@ is closed and no cooked data is available.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{read_all}{} \begin{methoddesc}{read_all}{}
Read all data until \EOF{}; block until connection closed. Read all data until \EOF; block until connection closed.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{read_some}{} \begin{methoddesc}{read_some}{}

View File

@ -50,7 +50,7 @@ are initialized at the first call to \function{mktemp()}.
When set to a value other than \code{None}, this variable defines the When set to a value other than \code{None}, this variable defines the
directory in which filenames returned by \function{mktemp()} reside. directory in which filenames returned by \function{mktemp()} reside.
The default is taken from the environment variable \envvar{TMPDIR}; if The default is taken from the environment variable \envvar{TMPDIR}; if
this is not set, either \file{/usr/tmp} is used (on \UNIX{}), or the this is not set, either \file{/usr/tmp} is used (on \UNIX), or the
current working directory (all other systems). No check is made to current working directory (all other systems). No check is made to
see whether its value is valid. see whether its value is valid.
\end{datadesc} \end{datadesc}
@ -68,7 +68,7 @@ When set to a value other than \code{None}, this variable defines the
prefix of the final component of the filenames returned by prefix of the final component of the filenames returned by
\function{mktemp()}. A string of decimal digits is added to generate \function{mktemp()}. A string of decimal digits is added to generate
unique filenames. The default is either \file{@\var{pid}.} where unique filenames. The default is either \file{@\var{pid}.} where
\var{pid} is the current process ID (on \UNIX{}), \var{pid} is the current process ID (on \UNIX),
\file{\textasciitilde\var{pid}-} on Windows NT, \file{Python-Tmp-} on \file{\textasciitilde\var{pid}-} on Windows NT, \file{Python-Tmp-} on
MacOS, or \file{tmp} (all other systems). MacOS, or \file{tmp} (all other systems).

View File

@ -5,7 +5,7 @@
\platform{Unix} \platform{Unix}
\modulesynopsis{\POSIX\ style tty control.} \modulesynopsis{\POSIX\ style tty control.}
\indexii{\POSIX{}}{I/O control} \indexii{\POSIX}{I/O control}
\indexii{tty}{I/O control} \indexii{tty}{I/O control}
@ -115,7 +115,7 @@ def getpass(prompt = "Password: "):
\module{termios} module.} \module{termios} module.}
\indexii{\POSIX{}}{I/O control} \indexii{\POSIX}{I/O control}
\indexii{tty}{I/O control} \indexii{tty}{I/O control}
\deprecated{2.1}{Import needed constants from \refmodule{termios} \deprecated{2.1}{Import needed constants from \refmodule{termios}

View File

@ -19,7 +19,7 @@ The module is optional. It is supported on Windows NT and '95, SGI
IRIX, Solaris 2.x, as well as on systems that have a \POSIX{} thread IRIX, Solaris 2.x, as well as on systems that have a \POSIX{} thread
(a.k.a. ``pthread'') implementation. (a.k.a. ``pthread'') implementation.
\index{pthreads} \index{pthreads}
\indexii{threads}{\POSIX{}} \indexii{threads}{\POSIX}
It defines the following constant and functions: It defines the following constant and functions:

View File

@ -16,13 +16,13 @@ An explanation of some terminology and conventions is in order.
\item \item
The \dfn{epoch}\index{epoch} is the point where the time starts. On The \dfn{epoch}\index{epoch} is the point where the time starts. On
January 1st of that year, at 0 hours, the ``time since the epoch'' is January 1st of that year, at 0 hours, the ``time since the epoch'' is
zero. For \UNIX{}, the epoch is 1970. To find out what the epoch is, zero. For \UNIX, the epoch is 1970. To find out what the epoch is,
look at \code{gmtime(0)}. look at \code{gmtime(0)}.
\item \item
The functions in this module do not handle dates and times before the The functions in this module do not handle dates and times before the
epoch or far in the future. The cut-off point in the future is epoch or far in the future. The cut-off point in the future is
determined by the C library; for \UNIX{}, it is typically in determined by the C library; for \UNIX, it is typically in
2038\index{Year 2038}. 2038\index{Year 2038}.
\item \item

View File

@ -12,7 +12,7 @@ The \module{tty} module defines functions for putting the tty into
cbreak and raw modes. cbreak and raw modes.
Because it requires the \refmodule{termios} module, it will work Because it requires the \refmodule{termios} module, it will work
only on \UNIX{}. only on \UNIX.
The \module{tty} module defines the following functions: The \module{tty} module defines the following functions:

View File

@ -39,7 +39,7 @@ Python.
The \module{Tkinter} module (``Tk interface'') is the standard Python The \module{Tkinter} module (``Tk interface'') is the standard Python
interface to the Tk GUI toolkit, now maintained at ActiveState. Both interface to the Tk GUI toolkit, now maintained at ActiveState. Both
Tk and \module{Tkinter} are available on most Unix platforms, as well Tk and \module{Tkinter} are available on most \UNIX{} platforms, as well
as on Windows and Macintosh systems. as on Windows and Macintosh systems.
\begin{seealso} \begin{seealso}
@ -1674,7 +1674,7 @@ most commonly used one.
\seetitle[http://www.wxwindows.org]{wxWindows}{ \seetitle[http://www.wxwindows.org]{wxWindows}{
is a GUI toolkit that combines the most attractive attributes of Qt, is a GUI toolkit that combines the most attractive attributes of Qt,
Tk, Motif, and GTK+ in one powerful and efficient package. It is Tk, Motif, and GTK+ in one powerful and efficient package. It is
implemented in \Cpp. wxWindows supports two flavors of Unix implemented in \Cpp. wxWindows supports two flavors of \UNIX{}
implementation: GTK+ and Motif, and under Windows, it has a standard implementation: GTK+ and Motif, and under Windows, it has a standard
Microsoft Foundation Classes (MFC) appearance, because it uses Win32 Microsoft Foundation Classes (MFC) appearance, because it uses Win32
widgets. There is a Python class wrapper, independent of Tkinter. widgets. There is a Python class wrapper, independent of Tkinter.

View File

@ -75,7 +75,7 @@ characters. A phrase between angular brackets (\code{<...>}) gives an
informal description of the symbol defined; e.g., this could be used informal description of the symbol defined; e.g., this could be used
to describe the notion of `control character' if needed. to describe the notion of `control character' if needed.
\index{lexical definitions} \index{lexical definitions}
\index{ASCII@\ASCII{}} \index{ASCII@\ASCII}
Even though the notation used is almost the same, there is a big Even though the notation used is almost the same, there is a big
difference between the meaning of lexical and syntactic definitions: difference between the meaning of lexical and syntactic definitions:

View File

@ -14,7 +14,7 @@ insert 8-bit characters in string literals is by using octal or
hexadecimal escape sequences. hexadecimal escape sequences.
The run-time character set depends on the I/O devices connected to the The run-time character set depends on the I/O devices connected to the
program but is generally a superset of \ASCII{}. program but is generally a superset of \ASCII.
\strong{Future compatibility note:} It may be tempting to assume that the \strong{Future compatibility note:} It may be tempting to assume that the
character set for 8-bit characters is ISO Latin-1 (an \ASCII{} character set for 8-bit characters is ISO Latin-1 (an \ASCII{}
@ -52,7 +52,7 @@ by following the explicit or implicit \emph{line joining} rules.
\subsection{Physical lines\label{physical}} \subsection{Physical lines\label{physical}}
A physical line ends in whatever the current platform's convention is A physical line ends in whatever the current platform's convention is
for terminating lines. On \UNIX{}, this is the \ASCII{} LF (linefeed) for terminating lines. On \UNIX, this is the \ASCII{} LF (linefeed)
character. On DOS/Windows, it is the \ASCII{} sequence CR LF (return character. On DOS/Windows, it is the \ASCII{} sequence CR LF (return
followed by linefeed). On Macintosh, it is the \ASCII{} CR (return) followed by linefeed). On Macintosh, it is the \ASCII{} CR (return)
character. character.
@ -142,7 +142,7 @@ turn is used to determine the grouping of statements.
First, tabs are replaced (from left to right) by one to eight spaces First, tabs are replaced (from left to right) by one to eight spaces
such that the total number of characters up to and including the such that the total number of characters up to and including the
replacement is a multiple of replacement is a multiple of
eight (this is intended to be the same rule as used by \UNIX{}). The eight (this is intended to be the same rule as used by \UNIX). The
total number of spaces preceding the first non-blank character then total number of spaces preceding the first non-blank character then
determines the line's indentation. Indentation cannot be split over determines the line's indentation. Indentation cannot be split over
multiple physical lines using backslashes; the whitespace up to the multiple physical lines using backslashes; the whitespace up to the
@ -308,7 +308,7 @@ Literals are notations for constant values of some built-in types.
String literals are described by the following lexical definitions: String literals are described by the following lexical definitions:
\index{string literal} \index{string literal}
\index{ASCII@\ASCII{}} \index{ASCII@\ASCII}
\begin{productionlist} \begin{productionlist}
\production{stringliteral} \production{stringliteral}
{[\token{stringprefix}](\token{shortstring} | \token{longstring})} {[\token{stringprefix}](\token{shortstring} | \token{longstring})}
@ -388,7 +388,7 @@ to those used by Standard C. The recognized escape sequences are:
\lineii{\e\var{ooo}} {\ASCII{} character with octal value \var{ooo}} \lineii{\e\var{ooo}} {\ASCII{} character with octal value \var{ooo}}
\lineii{\e x\var{hh}} {\ASCII{} character with hex value \var{hh}} \lineii{\e x\var{hh}} {\ASCII{} character with hex value \var{hh}}
\end{tableii} \end{tableii}
\index{ASCII@\ASCII{}} \index{ASCII@\ASCII}
As in Standard C, up to three octal digits are accepted. However, As in Standard C, up to three octal digits are accepted. However,
exactly two hex digits are taken in hex escapes. exactly two hex digits are taken in hex escapes.
@ -596,7 +596,7 @@ sequence of three periods has a special meaning as an ellipsis in slices.
The second half of the list, the augmented assignment operators, serve The second half of the list, the augmented assignment operators, serve
lexically as delimiters, but also perform an operation. lexically as delimiters, but also perform an operation.
The following printing ASCII characters have special meaning as part The following printing \ASCII{} characters have special meaning as part
of other tokens or are otherwise significant to the lexical analyzer: of other tokens or are otherwise significant to the lexical analyzer:
\begin{verbatim} \begin{verbatim}
@ -606,7 +606,7 @@ of other tokens or are otherwise significant to the lexical analyzer:
The following printing \ASCII{} characters are not used in Python. Their The following printing \ASCII{} characters are not used in Python. Their
occurrence outside string literals and comments is an unconditional occurrence outside string literals and comments is an unconditional
error: error:
\index{ASCII@\ASCII{}} \index{ASCII@\ASCII}
\begin{verbatim} \begin{verbatim}
@ $ ? @ $ ?

View File

@ -279,14 +279,14 @@ read from a file.
\obindex{string} \obindex{string}
\index{character} \index{character}
\index{byte} \index{byte}
\index{ASCII@\ASCII{}} \index{ASCII@\ASCII}
(On systems whose native character set is not \ASCII{}, strings may use (On systems whose native character set is not \ASCII, strings may use
EBCDIC in their internal representation, provided the functions EBCDIC in their internal representation, provided the functions
\function{chr()} and \function{ord()} implement a mapping between \ASCII{} and \function{chr()} and \function{ord()} implement a mapping between \ASCII{} and
EBCDIC, and string comparison preserves the \ASCII{} order. EBCDIC, and string comparison preserves the \ASCII{} order.
Or perhaps someone can propose a better rule?) Or perhaps someone can propose a better rule?)
\index{ASCII@\ASCII{}} \index{ASCII@\ASCII}
\index{EBCDIC} \index{EBCDIC}
\index{character set} \index{character set}
\indexii{string}{comparison} \indexii{string}{comparison}

View File

@ -52,7 +52,7 @@ For a description of standard objects and modules, see the
\citetitle[../lib/lib.html]{Python Library Reference} document. The \citetitle[../lib/lib.html]{Python Library Reference} document. The
\citetitle[../ref/ref.html]{Python Reference Manual} gives a more \citetitle[../ref/ref.html]{Python Reference Manual} gives a more
formal definition of the language. To write extensions in C or formal definition of the language. To write extensions in C or
\Cpp{}, read \citetitle[../ext/ext.html]{Extending and Embedding the \Cpp, read \citetitle[../ext/ext.html]{Extending and Embedding the
Python Interpreter} and \citetitle[../api/api.html]{Python/C API Python Interpreter} and \citetitle[../api/api.html]{Python/C API
Reference}. There are also several books covering Python in depth. Reference}. There are also several books covering Python in depth.
@ -182,7 +182,7 @@ you can exit the interpreter by typing the following commands:
\samp{import sys; sys.exit()}. \samp{import sys; sys.exit()}.
The interpreter's line-editing features usually aren't very The interpreter's line-editing features usually aren't very
sophisticated. On \UNIX{}, whoever installed the interpreter may have sophisticated. On \UNIX, whoever installed the interpreter may have
enabled support for the GNU readline library, which adds more enabled support for the GNU readline library, which adds more
elaborate interactive editing and history features. Perhaps the elaborate interactive editing and history features. Perhaps the
quickest check to see whether command line editing is supported is quickest check to see whether command line editing is supported is
@ -2230,7 +2230,7 @@ the environment variable \envvar{PYTHONPATH}. This has the same syntax as
the shell variable \envvar{PATH}, that is, a list of the shell variable \envvar{PATH}, that is, a list of
directory names. When \envvar{PYTHONPATH} is not set, or when the file directory names. When \envvar{PYTHONPATH} is not set, or when the file
is not found there, the search continues in an installation-dependent is not found there, the search continues in an installation-dependent
default path; on \UNIX{}, this is usually \file{.:/usr/local/lib/python}. default path; on \UNIX, this is usually \file{.:/usr/local/lib/python}.
Actually, modules are searched in the list of directories given by the Actually, modules are searched in the list of directories given by the
variable \code{sys.path} which is initialized from the directory variable \code{sys.path} which is initialized from the directory
@ -2599,7 +2599,7 @@ in the \module{Sound.Effects} package, it can use \code{from
Sound.Effects import echo}. Sound.Effects import echo}.
%(One could design a notation to refer to parent packages, similar to %(One could design a notation to refer to parent packages, similar to
%the use of ".." to refer to the parent directory in Unix and Windows %the use of ".." to refer to the parent directory in \UNIX{} and Windows
%filesystems. In fact, the \module{ni} module, which was the %filesystems. In fact, the \module{ni} module, which was the
%ancestor of this package system, supported this using \code{__} for %ancestor of this package system, supported this using \code{__} for
%the package containing the current module, %the package containing the current module,
@ -3335,7 +3335,7 @@ subscripting etc.) can be redefined for class instances.
Lacking universally accepted terminology to talk about classes, I will Lacking universally accepted terminology to talk about classes, I will
make occasional use of Smalltalk and \Cpp{} terms. (I would use Modula-3 make occasional use of Smalltalk and \Cpp{} terms. (I would use Modula-3
terms, since its object-oriented semantics are closer to those of terms, since its object-oriented semantics are closer to those of
Python than \Cpp{}, but I expect that few readers have heard of it.) Python than \Cpp, but I expect that few readers have heard of it.)
I also have to warn you that there's a terminological pitfall for I also have to warn you that there's a terminological pitfall for
object-oriented readers: the word ``object'' in Python does not object-oriented readers: the word ``object'' in Python does not
@ -3592,7 +3592,7 @@ two kinds of valid attribute names.
The first I'll call \emph{data attributes}. These correspond to The first I'll call \emph{data attributes}. These correspond to
``instance variables'' in Smalltalk, and to ``data members'' in ``instance variables'' in Smalltalk, and to ``data members'' in
\Cpp{}. Data attributes need not be declared; like local variables, \Cpp. Data attributes need not be declared; like local variables,
they spring into existence when they are first assigned to. For they spring into existence when they are first assigned to. For
example, if \code{x} is the instance of \class{MyClass} created above, example, if \code{x} is the instance of \class{MyClass} created above,
the following piece of code will print the value \code{16}, without the following piece of code will print the value \code{16}, without