Kaydet (Commit) eb0f066f authored tarafından Guido van Rossum's avatar Guido van Rossum

Correct small nits reported by Rob Hooft.

üst 51ca6e3e
......@@ -2,7 +2,7 @@
Exceptions can be class objects or string objects. While
traditionally, most exceptions have been string objects, in Python
1.5a4, all standard exceptions have been converted to class objects,
1.5, all standard exceptions have been converted to class objects,
and users are encouraged to the the same. The source code for those
exceptions is present in the standard library module
\code{exceptions}; this module never needs to be imported explicitly.
......@@ -20,7 +20,7 @@ The string value of all built-in exceptions is their name, but this is
not a requirement for user-defined exceptions or exceptions defined by
library modules.
For class exceptions, in a \code{try} statement with an\code{except}
For class exceptions, in a \code{try} statement with an \code{except}
clause that mentions a particular class, that clause also handles
any exception classes derived from that class (but not exception
classes from which \emph{it} is derived). Two exception classes
......
......@@ -126,14 +126,14 @@ class instances are callable if they have an attribute \code{__call__}.
\end{funcdesc}
\begin{funcdesc}{dir}{}
XXX New functionality takes anything and looks in __dict__,
__methods__, __members__.
Without arguments, return the list of names in the current local
symbol table. With a module, class or class instance object as
argument (or anything else that has a \code{__dict__} attribute),
returns the list of names in that object's attribute dictionary.
The resulting list is sorted. For example:
symbol table. With an argument, attempts to return a list of valid
attribute for that object. This information is gleaned from the
object's \code{__dict__}, \code{__methods__} and \code{__members__}
attributes, if defined. The list is not necessarily complete; e.g.,
for classes, attributes defined in base classes are not included,
and for class instances, methods are not included.
The resulting list is sorted alphabetically. For example:
\bcode\begin{verbatim}
>>> import sys
......@@ -146,8 +146,8 @@ __methods__, __members__.
\end{funcdesc}
\begin{funcdesc}{divmod}{a\, b}
Take two numbers as arguments and return a pair of integers
consisting of their integer quotient and remainder. With mixed
Take two numbers as arguments and return a pair of numbers consisting
of their quotient and remainder when using long division. With mixed
operand types, the rules for binary arithmetic operators apply. For
plain and long integers, the result is the same as
\code{(\var{a} / \var{b}, \var{a} \%{} \var{b})}.
......@@ -249,7 +249,7 @@ module from which it is called).
\begin{funcdesc}{hash}{object}
Return the hash value of the object (if it has one). Hash values
are 32-bit integers. They are used to quickly compare dictionary
are integers. They are used to quickly compare dictionary
keys during a dictionary lookup. Numeric values that compare equal
have the same hash value (even if they are of different types, e.g.
1 and 1.0).
......@@ -275,8 +275,8 @@ module from which it is called).
\begin{funcdesc}{input}{\optional{prompt}}
Almost equivalent to \code{eval(raw_input(\var{prompt}))}. Like
\code{raw_input()}, the \var{prompt} argument is optional, and GNU
readline is used when configured. The difference
\code{raw_input()}, the \var{prompt} argument is optional, and the
\code{readline} module is used when loaded. The difference
is that a long input expression may be broken over multiple lines using
the backslash convention.
\end{funcdesc}
......@@ -348,7 +348,7 @@ desired effect.
arbitrary size, possibly embedded in whitespace;
this behaves identical to \code{string.atol(\var{x})}.
Otherwise, the argument may be a plain or
long integer or a floating point number, and a long interger with
long integer or a floating point number, and a long integer with
the same value is returned. Conversion of floating
point numbers to integers is defined by the C semantics;
see the description of \code{int()}.
......@@ -481,7 +481,7 @@ there's no reliable way to determine whether this is the case.}
>>>
\end{verbatim}\ecode
If the interpreter was built to use the GNU readline library, then
If the \code{readline} module was loaded, then
\code{raw_input()} will use it to provide elaborate
line editing and history features.
\end{funcdesc}
......
......@@ -75,7 +75,7 @@ Using long option names is equally easy:
\end{verbatim}\ecode
%
The exception
\code{getopt.error = 'getopt.error'}
\code{getopt.error}
is raised when an unrecognized option is found in the argument list or
when an option requiring an argument is given none.
The argument to the exception is a string indicating the cause of the
......
......@@ -15,7 +15,7 @@ The gid is an integer, name and password are strings, and the member
list is a list of strings.
(Note that most users are not explicitly listed as members of the
group they are in according to the password database.)
An exception is raised if the entry asked for cannot be found.
A \code{KeyError} exception is raised if the entry asked for cannot be found.
It defines the following items:
......
......@@ -21,7 +21,7 @@ object, though it's not possible to use the \code{seek()} and
The \file{gzip} file format includes the original filename of the
uncompressed file; when opening a \code{GzipFile} object for
writing, it can be set by the \var{filename} argument. The default
value is \code{"GzippedFile"}.
value is an empty string.
\var{mode} can be either \code{'r'} or \code{'w'} depending on
whether the file will be read or written. \var{compresslevel} is an
......
......@@ -148,17 +148,17 @@ Return a string representing the current working directory.
\end{funcdesc}
\begin{funcdesc}{getegid}{}
Return the current process's effective group id.
Return the current process' effective group id.
(Not on MS-DOS.)
\end{funcdesc}
\begin{funcdesc}{geteuid}{}
Return the current process's effective user id.
Return the current process' effective user id.
(Not on MS-DOS.)
\end{funcdesc}
\begin{funcdesc}{getgid}{}
Return the current process's group id.
Return the current process' group id.
(Not on MS-DOS.)
\end{funcdesc}
......@@ -178,7 +178,7 @@ Return the parent's process id.
\end{funcdesc}
\begin{funcdesc}{getuid}{}
Return the current process's user id.
Return the current process' user id.
(Not on MS-DOS.)
\end{funcdesc}
......@@ -326,7 +326,7 @@ Remove the directory \var{path}.
\end{funcdesc}
\begin{funcdesc}{setgid}{gid}
Set the current process's group id.
Set the current process' group id.
(Not on MS-DOS.)
\end{funcdesc}
......@@ -350,7 +350,7 @@ semantics.
\end{funcdesc}
\begin{funcdesc}{setuid}{uid}
Set the current process's user id.
Set the current process' user id.
(Not on MS-DOS.)
\end{funcdesc}
......@@ -424,8 +424,9 @@ operating system. The tuple contains 5 strings:
\code{(\var{sysname}, \var{nodename}, \var{release}, \var{version}, \var{machine})}.
Some systems truncate the nodename to 8
characters or to the leading component; a better way to get the
hostname is \code{socket.gethostname()}. (Not on MS-DOS, nor on older
\UNIX{} systems.)
hostname is \code{socket.gethostname()} or even
\code{socket.gethostbyaddr(socket.gethostname())}.
(Not on MS-DOS, nor on older \UNIX{} systems.)
\end{funcdesc}
\begin{funcdesc}{unlink}{path}
......
......@@ -15,7 +15,7 @@ following items from the password database (see \file{<pwd.h>}), in order:
\code{pw_dir},
\code{pw_shell}.
The uid and gid items are integers, all others are strings.
An exception is raised if the entry asked for cannot be found.
A \code{KeyError} exception is raised if the entry asked for cannot be found.
It defines the following items:
......
......@@ -133,7 +133,7 @@ simply match the '\code{\^}' character.
%
\item[\code{|}]\code{A|B}, where A and B can be arbitrary REs,
creates a regular expression that will match either A or B. This can
be used inside groups (see below) as well. To match a literal '|',
be used inside groups (see below) as well. To match a literal '\code{|}',
use \code{\e|}, or enclose it inside a character class, like \code{[|]}.
%
\item[\code{(...)}] Matches whatever regular expression is inside the
......
......@@ -37,7 +37,7 @@ regular expression represented as a string literal, you have to
\emph{quadruple} it or enclose it in a singleton character class.
E.g.\ to extract \LaTeX\ \samp{\e section\{{\rm
\ldots}\}} headers from a document, you can use this pattern:
\code{'[\e ] section\{\e (.*\e )\}'}. \emph{Another exception:}
\code{'[\e ]section\{\e (.*\e )\}'}. \emph{Another exception:}
the escape sequece \samp{\e b} is significant in string literals
(where it means the ASCII bell character) as well as in Emacs regular
expressions (where it stands for a word boundary), so in order to
......@@ -125,7 +125,7 @@ The special sequences consist of '\code{\e}' and a character
from the list below. If the ordinary character is not on the list,
then the resulting RE will match the second character. For example,
\code{\e\$} matches the character '\$'. Ones where the backslash
should be doubled are indicated.
should be doubled in string literals are indicated.
\begin{itemize}
\item[\code{\e|}]\code{A\e|B}, where A and B can be arbitrary REs,
......
......@@ -729,7 +729,7 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends.
\begin{funcdesc}{readlines}{\optional{sizehint}}
Read until \EOF{} using \code{readline()} and return a list containing
the lines thus read. If the optional \var{bufferhint} argument is
the lines thus read. If the optional \var{sizehint} argument is
present, instead of reading up to \EOF{}, whole lines totalling
approximately \var{sizehint} bytes are read.
\end{funcdesc}
......
% XXX The module has been extended (by Jeremy) but this documentation hasn't been updated yet
\section{Built-in Module \sectcode{zlib}}
\label{module-zlib}
\bimodindex{zlib}
......@@ -6,7 +8,7 @@ For applications that require data compression, the functions in this
module allow compression and decompression, using the zlib library,
which is based on GNU zip. The zlib library has its own home page at
\code{http://www.cdrom.com/pub/infozip/zlib/}.
Version 1.0.4 is the most recent version as of April 30, 1997; use a
Version 1.0.4 is the most recent version as of December, 1997; use a
later version if one is available.
The available functions in this module are:
......
......@@ -2,7 +2,7 @@
Exceptions can be class objects or string objects. While
traditionally, most exceptions have been string objects, in Python
1.5a4, all standard exceptions have been converted to class objects,
1.5, all standard exceptions have been converted to class objects,
and users are encouraged to the the same. The source code for those
exceptions is present in the standard library module
\code{exceptions}; this module never needs to be imported explicitly.
......@@ -20,7 +20,7 @@ The string value of all built-in exceptions is their name, but this is
not a requirement for user-defined exceptions or exceptions defined by
library modules.
For class exceptions, in a \code{try} statement with an\code{except}
For class exceptions, in a \code{try} statement with an \code{except}
clause that mentions a particular class, that clause also handles
any exception classes derived from that class (but not exception
classes from which \emph{it} is derived). Two exception classes
......
......@@ -126,14 +126,14 @@ class instances are callable if they have an attribute \code{__call__}.
\end{funcdesc}
\begin{funcdesc}{dir}{}
XXX New functionality takes anything and looks in __dict__,
__methods__, __members__.
Without arguments, return the list of names in the current local
symbol table. With a module, class or class instance object as
argument (or anything else that has a \code{__dict__} attribute),
returns the list of names in that object's attribute dictionary.
The resulting list is sorted. For example:
symbol table. With an argument, attempts to return a list of valid
attribute for that object. This information is gleaned from the
object's \code{__dict__}, \code{__methods__} and \code{__members__}
attributes, if defined. The list is not necessarily complete; e.g.,
for classes, attributes defined in base classes are not included,
and for class instances, methods are not included.
The resulting list is sorted alphabetically. For example:
\bcode\begin{verbatim}
>>> import sys
......@@ -146,8 +146,8 @@ __methods__, __members__.
\end{funcdesc}
\begin{funcdesc}{divmod}{a\, b}
Take two numbers as arguments and return a pair of integers
consisting of their integer quotient and remainder. With mixed
Take two numbers as arguments and return a pair of numbers consisting
of their quotient and remainder when using long division. With mixed
operand types, the rules for binary arithmetic operators apply. For
plain and long integers, the result is the same as
\code{(\var{a} / \var{b}, \var{a} \%{} \var{b})}.
......@@ -249,7 +249,7 @@ module from which it is called).
\begin{funcdesc}{hash}{object}
Return the hash value of the object (if it has one). Hash values
are 32-bit integers. They are used to quickly compare dictionary
are integers. They are used to quickly compare dictionary
keys during a dictionary lookup. Numeric values that compare equal
have the same hash value (even if they are of different types, e.g.
1 and 1.0).
......@@ -275,8 +275,8 @@ module from which it is called).
\begin{funcdesc}{input}{\optional{prompt}}
Almost equivalent to \code{eval(raw_input(\var{prompt}))}. Like
\code{raw_input()}, the \var{prompt} argument is optional, and GNU
readline is used when configured. The difference
\code{raw_input()}, the \var{prompt} argument is optional, and the
\code{readline} module is used when loaded. The difference
is that a long input expression may be broken over multiple lines using
the backslash convention.
\end{funcdesc}
......@@ -348,7 +348,7 @@ desired effect.
arbitrary size, possibly embedded in whitespace;
this behaves identical to \code{string.atol(\var{x})}.
Otherwise, the argument may be a plain or
long integer or a floating point number, and a long interger with
long integer or a floating point number, and a long integer with
the same value is returned. Conversion of floating
point numbers to integers is defined by the C semantics;
see the description of \code{int()}.
......@@ -481,7 +481,7 @@ there's no reliable way to determine whether this is the case.}
>>>
\end{verbatim}\ecode
If the interpreter was built to use the GNU readline library, then
If the \code{readline} module was loaded, then
\code{raw_input()} will use it to provide elaborate
line editing and history features.
\end{funcdesc}
......
......@@ -75,7 +75,7 @@ Using long option names is equally easy:
\end{verbatim}\ecode
%
The exception
\code{getopt.error = 'getopt.error'}
\code{getopt.error}
is raised when an unrecognized option is found in the argument list or
when an option requiring an argument is given none.
The argument to the exception is a string indicating the cause of the
......
......@@ -15,7 +15,7 @@ The gid is an integer, name and password are strings, and the member
list is a list of strings.
(Note that most users are not explicitly listed as members of the
group they are in according to the password database.)
An exception is raised if the entry asked for cannot be found.
A \code{KeyError} exception is raised if the entry asked for cannot be found.
It defines the following items:
......
......@@ -21,7 +21,7 @@ object, though it's not possible to use the \code{seek()} and
The \file{gzip} file format includes the original filename of the
uncompressed file; when opening a \code{GzipFile} object for
writing, it can be set by the \var{filename} argument. The default
value is \code{"GzippedFile"}.
value is an empty string.
\var{mode} can be either \code{'r'} or \code{'w'} depending on
whether the file will be read or written. \var{compresslevel} is an
......
......@@ -148,17 +148,17 @@ Return a string representing the current working directory.
\end{funcdesc}
\begin{funcdesc}{getegid}{}
Return the current process's effective group id.
Return the current process' effective group id.
(Not on MS-DOS.)
\end{funcdesc}
\begin{funcdesc}{geteuid}{}
Return the current process's effective user id.
Return the current process' effective user id.
(Not on MS-DOS.)
\end{funcdesc}
\begin{funcdesc}{getgid}{}
Return the current process's group id.
Return the current process' group id.
(Not on MS-DOS.)
\end{funcdesc}
......@@ -178,7 +178,7 @@ Return the parent's process id.
\end{funcdesc}
\begin{funcdesc}{getuid}{}
Return the current process's user id.
Return the current process' user id.
(Not on MS-DOS.)
\end{funcdesc}
......@@ -326,7 +326,7 @@ Remove the directory \var{path}.
\end{funcdesc}
\begin{funcdesc}{setgid}{gid}
Set the current process's group id.
Set the current process' group id.
(Not on MS-DOS.)
\end{funcdesc}
......@@ -350,7 +350,7 @@ semantics.
\end{funcdesc}
\begin{funcdesc}{setuid}{uid}
Set the current process's user id.
Set the current process' user id.
(Not on MS-DOS.)
\end{funcdesc}
......@@ -424,8 +424,9 @@ operating system. The tuple contains 5 strings:
\code{(\var{sysname}, \var{nodename}, \var{release}, \var{version}, \var{machine})}.
Some systems truncate the nodename to 8
characters or to the leading component; a better way to get the
hostname is \code{socket.gethostname()}. (Not on MS-DOS, nor on older
\UNIX{} systems.)
hostname is \code{socket.gethostname()} or even
\code{socket.gethostbyaddr(socket.gethostname())}.
(Not on MS-DOS, nor on older \UNIX{} systems.)
\end{funcdesc}
\begin{funcdesc}{unlink}{path}
......
......@@ -15,7 +15,7 @@ following items from the password database (see \file{<pwd.h>}), in order:
\code{pw_dir},
\code{pw_shell}.
The uid and gid items are integers, all others are strings.
An exception is raised if the entry asked for cannot be found.
A \code{KeyError} exception is raised if the entry asked for cannot be found.
It defines the following items:
......
......@@ -133,7 +133,7 @@ simply match the '\code{\^}' character.
%
\item[\code{|}]\code{A|B}, where A and B can be arbitrary REs,
creates a regular expression that will match either A or B. This can
be used inside groups (see below) as well. To match a literal '|',
be used inside groups (see below) as well. To match a literal '\code{|}',
use \code{\e|}, or enclose it inside a character class, like \code{[|]}.
%
\item[\code{(...)}] Matches whatever regular expression is inside the
......
......@@ -37,7 +37,7 @@ regular expression represented as a string literal, you have to
\emph{quadruple} it or enclose it in a singleton character class.
E.g.\ to extract \LaTeX\ \samp{\e section\{{\rm
\ldots}\}} headers from a document, you can use this pattern:
\code{'[\e ] section\{\e (.*\e )\}'}. \emph{Another exception:}
\code{'[\e ]section\{\e (.*\e )\}'}. \emph{Another exception:}
the escape sequece \samp{\e b} is significant in string literals
(where it means the ASCII bell character) as well as in Emacs regular
expressions (where it stands for a word boundary), so in order to
......@@ -125,7 +125,7 @@ The special sequences consist of '\code{\e}' and a character
from the list below. If the ordinary character is not on the list,
then the resulting RE will match the second character. For example,
\code{\e\$} matches the character '\$'. Ones where the backslash
should be doubled are indicated.
should be doubled in string literals are indicated.
\begin{itemize}
\item[\code{\e|}]\code{A\e|B}, where A and B can be arbitrary REs,
......
......@@ -729,7 +729,7 @@ descriptors, e.g. module \code{fcntl} or \code{os.read()} and friends.
\begin{funcdesc}{readlines}{\optional{sizehint}}
Read until \EOF{} using \code{readline()} and return a list containing
the lines thus read. If the optional \var{bufferhint} argument is
the lines thus read. If the optional \var{sizehint} argument is
present, instead of reading up to \EOF{}, whole lines totalling
approximately \var{sizehint} bytes are read.
\end{funcdesc}
......
% XXX The module has been extended (by Jeremy) but this documentation hasn't been updated yet
\section{Built-in Module \sectcode{zlib}}
\label{module-zlib}
\bimodindex{zlib}
......@@ -6,7 +8,7 @@ For applications that require data compression, the functions in this
module allow compression and decompression, using the zlib library,
which is based on GNU zip. The zlib library has its own home page at
\code{http://www.cdrom.com/pub/infozip/zlib/}.
Version 1.0.4 is the most recent version as of April 30, 1997; use a
Version 1.0.4 is the most recent version as of December, 1997; use a
later version if one is available.
The available functions in this module are:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment