Commit d45d8364 authored by Fred Drake's avatar Fred Drake

Fix up a few style nits -- avoid "e.g." and "i.e." -- these make

translation more difficult, as well as reading the English more
difficult for non-native speakers.
parent 74cab753
...@@ -13,7 +13,7 @@ This module searches for an OS dependent built-in module like ...@@ -13,7 +13,7 @@ This module searches for an OS dependent built-in module like
\module{mac} or \refmodule{posix} and exports the same functions and data \module{mac} or \refmodule{posix} and exports the same functions and data
as found there. The design of all Python's built-in OS dependent as found there. The design of all Python's built-in OS dependent
modules is such that as long as the same functionality is available, modules is such that as long as the same functionality is available,
it uses the same interface; e.g., the function it uses the same interface; for example, the function
\code{os.stat(\var{path})} returns stat information about \var{path} in \code{os.stat(\var{path})} returns stat information about \var{path} in
the same format (which happens to have originated with the the same format (which happens to have originated with the
\POSIX{} interface). \POSIX{} interface).
...@@ -42,9 +42,9 @@ directly from the \module{os} module. ...@@ -42,9 +42,9 @@ directly from the \module{os} module.
\begin{excdesc}{error} \begin{excdesc}{error}
This exception is raised when a function returns a This exception is raised when a function returns a system-related
system-related error (e.g., not for illegal argument types). This is error (not for illegal argument types or other incidental errors).
also known as the built-in exception \exception{OSError}. The This is also known as the built-in exception \exception{OSError}. The
accompanying value is a pair containing the numeric error code from accompanying value is a pair containing the numeric error code from
\cdata{errno} and the corresponding string, as would be printed by the \cdata{errno} and the corresponding string, as would be printed by the
C function \cfunction{perror()}. See the module C function \cfunction{perror()}. See the module
...@@ -55,7 +55,7 @@ When exceptions are classes, this exception carries two attributes, ...@@ -55,7 +55,7 @@ When exceptions are classes, this exception carries two attributes,
\member{errno} and \member{strerror}. The first holds the value of \member{errno} and \member{strerror}. The first holds the value of
the C \cdata{errno} variable, and the latter holds the corresponding the C \cdata{errno} variable, and the latter holds the corresponding
error message from \cfunction{strerror()}. For exceptions that error message from \cfunction{strerror()}. For exceptions that
involve a file system path (e.g. \function{chdir()} or involve a file system path (such as \function{chdir()} or
\function{unlink()}), the exception instance will contain a third \function{unlink()}), the exception instance will contain a third
attribute, \member{filename}, which is the file name passed to the attribute, \member{filename}, which is the file name passed to the
function. function.
...@@ -72,10 +72,11 @@ have currently been registered: \code{'posix'}, \code{'nt'}, ...@@ -72,10 +72,11 @@ have currently been registered: \code{'posix'}, \code{'nt'},
\begin{datadesc}{path} \begin{datadesc}{path}
The corresponding OS dependent standard module for pathname The corresponding OS dependent standard module for pathname
operations, e.g., \module{posixpath} or \module{macpath}. Thus, given operations, such as \module{posixpath} or \module{macpath}. Thus,
the proper imports, \code{os.path.split(\var{file})} is equivalent to but given the proper imports, \code{os.path.split(\var{file})} is
more portable than \code{posixpath.split(\var{file})}. Note that this equivalent to but more portable than
is also a valid module: it may be imported directly as \code{posixpath.split(\var{file})}. Note that this is also an
importable module: it may be imported directly as
\refmodule{os.path}. \refmodule{os.path}.
\end{datadesc} \end{datadesc}
...@@ -858,15 +859,15 @@ Availability: \UNIX{}, Windows. ...@@ -858,15 +859,15 @@ Availability: \UNIX{}, Windows.
\begin{funcdesc}{execv}{path, args} \begin{funcdesc}{execv}{path, args}
Execute the executable \var{path} with argument list \var{args}, Execute the executable \var{path} with argument list \var{args},
replacing the current process (i.e., the Python interpreter). replacing the current process (the Python interpreter).
The argument list may be a tuple or list of strings. The argument list may be a tuple or list of strings.
Availability: \UNIX{}, Windows. Availability: \UNIX{}, Windows.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{execve}{path, args, env} \begin{funcdesc}{execve}{path, args, env}
Execute the executable \var{path} with argument list \var{args}, Execute the executable \var{path} with argument list \var{args},
and environment \var{env}, and environment \var{env}, replacing the current process (the Python
replacing the current process (i.e., the Python interpreter). interpreter).
The argument list may be a tuple or list of strings. The argument list may be a tuple or list of strings.
The environment must be a dictionary mapping strings to strings. The environment must be a dictionary mapping strings to strings.
Availability: \UNIX{}, Windows. Availability: \UNIX{}, Windows.
...@@ -1150,20 +1151,20 @@ Higher-level operations on pathnames are defined in the ...@@ -1150,20 +1151,20 @@ Higher-level operations on pathnames are defined in the
\begin{datadesc}{curdir} \begin{datadesc}{curdir}
The constant string used by the OS to refer to the current directory, The constant string used by the OS to refer to the current directory.
e.g.\ \code{'.'} for \POSIX{} or \code{':'} for the Macintosh. For example: \code{'.'} for \POSIX{} or \code{':'} for the Macintosh.
\end{datadesc} \end{datadesc}
\begin{datadesc}{pardir} \begin{datadesc}{pardir}
The constant string used by the OS to refer to the parent directory, The constant string used by the OS to refer to the parent directory.
e.g.\ \code{'..'} for \POSIX{} or \code{'::'} for the Macintosh. For example: \code{'..'} for \POSIX{} or \code{'::'} for the Macintosh.
\end{datadesc} \end{datadesc}
\begin{datadesc}{sep} \begin{datadesc}{sep}
The character used by the OS to separate pathname components, The character used by the OS to separate pathname components,
e.g.\ \character{/} for \POSIX{} or \character{:} for the Macintosh. for example, \character{/} for \POSIX{} or \character{:} for the
Note that knowing this is not sufficient to be able to parse or Macintosh. Note that knowing this is not sufficient to be able to
concatenate pathnames --- use \function{os.path.split()} and parse or concatenate pathnames --- use \function{os.path.split()} and
\function{os.path.join()} --- but it is occasionally useful. \function{os.path.join()} --- but it is occasionally useful.
\end{datadesc} \end{datadesc}
...@@ -1175,7 +1176,7 @@ or \code{None} if only one separator character exists. This is set to ...@@ -1175,7 +1176,7 @@ or \code{None} if only one separator character exists. This is set to
\begin{datadesc}{pathsep} \begin{datadesc}{pathsep}
The character conventionally used by the OS to separate search patch The character conventionally used by the OS to separate search patch
components (as in \envvar{PATH}), e.g.\ \character{:} for \POSIX{} or components (as in \envvar{PATH}), such as \character{:} for \POSIX{} or
\character{;} for DOS and Windows. \character{;} for DOS and Windows.
\end{datadesc} \end{datadesc}
...@@ -1186,7 +1187,7 @@ doesn't have a \code{'PATH'} key. ...@@ -1186,7 +1187,7 @@ doesn't have a \code{'PATH'} key.
\begin{datadesc}{linesep} \begin{datadesc}{linesep}
The string used to separate (or, rather, terminate) lines on the The string used to separate (or, rather, terminate) lines on the
current platform. This may be a single character, current platform. This may be a single character, such as \code{'\e
e.g.\ \code{'\e n'} for \POSIX{} or \code{'\e r'} for MacOS, or multiple n'} for \POSIX{} or \code{'\e r'} for MacOS, or multiple characters,
characters, e.g.\ \code{'\e r\e n'} for MS-DOS and MS Windows. for example, \code{'\e r\e n'} for MS-DOS and MS Windows.
\end{datadesc} \end{datadesc}
...@@ -319,8 +319,8 @@ made in calls to sub-functions), ...@@ -319,8 +319,8 @@ made in calls to sub-functions),
is the quotient of \code{tottime} divided by \code{ncalls} is the quotient of \code{tottime} divided by \code{ncalls}
\item[cumtime ] \item[cumtime ]
is the total time spent in this and all subfunctions (i.e., from is the total time spent in this and all subfunctions (from invocation
invocation till exit). This figure is accurate \emph{even} for recursive till exit). This figure is accurate \emph{even} for recursive
functions. functions.
\item[percall ] \item[percall ]
...@@ -331,11 +331,11 @@ provides the respective data of each function ...@@ -331,11 +331,11 @@ provides the respective data of each function
\end{description} \end{description}
When there are two numbers in the first column (e.g.: \samp{43/3}), When there are two numbers in the first column (for example,
then the latter is the number of primitive calls, and the former is \samp{43/3}), then the latter is the number of primitive calls, and
the actual number of calls. Note that when the function does not the former is the actual number of calls. Note that when the function
recurse, these two values are the same, and only the single figure is does not recurse, these two values are the same, and only the single
printed. figure is printed.
\end{funcdesc} \end{funcdesc}
...@@ -355,7 +355,7 @@ The file selected by the above constructor must have been created by ...@@ -355,7 +355,7 @@ The file selected by the above constructor must have been created by
the corresponding version of \module{profile}. To be specific, there is the corresponding version of \module{profile}. To be specific, there is
\emph{no} file compatibility guaranteed with future versions of this \emph{no} file compatibility guaranteed with future versions of this
profiler, and there is no compatibility with files produced by other profiler, and there is no compatibility with files produced by other
profilers (e.g., the old system profiler). profilers (such as the old system profiler).
If several files are provided, all the statistics for identical If several files are provided, all the statistics for identical
functions will be coalesced, so that an overall view of several functions will be coalesced, so that an overall view of several
...@@ -377,7 +377,7 @@ modifies the object, and the stripped information is lost. After ...@@ -377,7 +377,7 @@ modifies the object, and the stripped information is lost. After
performing a strip operation, the object is considered to have its performing a strip operation, the object is considered to have its
entries in a ``random'' order, as it was just after object entries in a ``random'' order, as it was just after object
initialization and loading. If \method{strip_dirs()} causes two initialization and loading. If \method{strip_dirs()} causes two
function names to be indistinguishable (i.e., they are on the same function names to be indistinguishable (they are on the same
line of the same filename, and have the same function name), then the line of the same filename, and have the same function name), then the
statistics for these two entries are accumulated into a single entry. statistics for these two entries are accumulated into a single entry.
\end{methoddesc} \end{methoddesc}
...@@ -423,7 +423,7 @@ defined: ...@@ -423,7 +423,7 @@ defined:
Note that all sorts on statistics are in descending order (placing Note that all sorts on statistics are in descending order (placing
most time consuming items first), where as name, file, and line number most time consuming items first), where as name, file, and line number
searches are in ascending order (i.e., alphabetical). The subtle searches are in ascending order (alphabetical). The subtle
distinction between \code{'nfl'} and \code{'stdname'} is that the distinction between \code{'nfl'} and \code{'stdname'} is that the
standard name is a sort of the name as printed, which means that the standard name is a sort of the name as printed, which means that the
embedded line numbers get compared in an odd way. For example, lines embedded line numbers get compared in an odd way. For example, lines
...@@ -538,10 +538,10 @@ value was obtained (and then squirreled away), until the user's code ...@@ -538,10 +538,10 @@ value was obtained (and then squirreled away), until the user's code
is once again executing. As a result, functions that are called many is once again executing. As a result, functions that are called many
times, or call many functions, will typically accumulate this error. times, or call many functions, will typically accumulate this error.
The error that accumulates in this fashion is typically less than the The error that accumulates in this fashion is typically less than the
accuracy of the clock (i.e., less than one clock tick), but it accuracy of the clock (less than one clock tick), but it
\emph{can} accumulate and become very significant. This profiler \emph{can} accumulate and become very significant. This profiler
provides a means of calibrating itself for a given platform so that provides a means of calibrating itself for a given platform so that
this error can be probabilistically (i.e., on the average) removed. this error can be probabilistically (on the average) removed.
After the profiler is calibrated, it will be more accurate (in a least After the profiler is calibrated, it will be more accurate (in a least
square sense), but it will sometimes produce negative numbers (when square sense), but it will sometimes produce negative numbers (when
call counts are exceptionally low, and the gods of probability work call counts are exceptionally low, and the gods of probability work
...@@ -695,8 +695,8 @@ class MyProfiler(Profile): ...@@ -695,8 +695,8 @@ class MyProfiler(Profile):
The following derived profiler simulates the old style profiler, The following derived profiler simulates the old style profiler,
providing errant results on recursive functions. The reason for the providing errant results on recursive functions. The reason for the
usefulness of this profiler is that it runs faster (i.e., less usefulness of this profiler is that it runs faster (less
overhead) than the old profiler. It still creates all the caller overhead) than the new profiler. It still creates all the caller
stats, and is quite useful when there is \emph{no} recursion in the stats, and is quite useful when there is \emph{no} recursion in the
user's code. It is also a lot more accurate than the old profiler, as user's code. It is also a lot more accurate than the old profiler, as
it does not charge all its overhead time to the user's code. it does not charge all its overhead time to the user's code.
......
...@@ -229,9 +229,10 @@ referenced as the numbered group 1. ...@@ -229,9 +229,10 @@ referenced as the numbered group 1.
For example, if the pattern is For example, if the pattern is
\regexp{(?P<id>[a-zA-Z_]\e w*)}, the group can be referenced by its \regexp{(?P<id>[a-zA-Z_]\e w*)}, the group can be referenced by its
name in arguments to methods of match objects, such as \code{m.group('id')} name in arguments to methods of match objects, such as
or \code{m.end('id')}, and also by name in pattern text \code{m.group('id')} or \code{m.end('id')}, and also by name in
(e.g. \regexp{(?P=id)}) and replacement text (e.g. \code{\e g<id>}). pattern text (for example, \regexp{(?P=id)}) and replacement text
(such as \code{\e g<id>}).
\item[\code{(?P=\var{name})}] Matches whatever text was matched by the \item[\code{(?P=\var{name})}] Matches whatever text was matched by the
earlier group named \var{name}. earlier group named \var{name}.
...@@ -516,7 +517,7 @@ replacement string. For example: ...@@ -516,7 +517,7 @@ replacement string. For example:
The pattern may be a string or an RE object; if you need to specify The pattern may be a string or an RE object; if you need to specify
regular expression flags, you must use a RE object, or use regular expression flags, you must use a RE object, or use
embedded modifiers in a pattern; e.g. embedded modifiers in a pattern; for example,
\samp{sub("(?i)b+", "x", "bbbb BBBB")} returns \code{'x x'}. \samp{sub("(?i)b+", "x", "bbbb BBBB")} returns \code{'x x'}.
The optional argument \var{count} is the maximum number of pattern The optional argument \var{count} is the maximum number of pattern
...@@ -555,9 +556,10 @@ Perform the same operation as \function{sub()}, but return a tuple ...@@ -555,9 +556,10 @@ Perform the same operation as \function{sub()}, but return a tuple
\begin{excdesc}{error} \begin{excdesc}{error}
Exception raised when a string passed to one of the functions here Exception raised when a string passed to one of the functions here
is not a valid regular expression (e.g., unmatched parentheses) or is not a valid regular expression (for example, it might contain
when some other error occurs during compilation or matching. It is unmatched parentheses) or when some other error occurs during
never an error if a string contains no match for a pattern. compilation or matching. It is never an error if a string contains
no match for a pattern.
\end{excdesc} \end{excdesc}
...@@ -654,7 +656,7 @@ corresponding group. ...@@ -654,7 +656,7 @@ corresponding group.
Returns one or more subgroups of the match. If there is a single Returns one or more subgroups of the match. If there is a single
argument, the result is a single string; if there are argument, the result is a single string; if there are
multiple arguments, the result is a tuple with one item per argument. multiple arguments, the result is a tuple with one item per argument.
Without arguments, \var{group1} defaults to zero (i.e. the whole match Without arguments, \var{group1} defaults to zero (the whole match
is returned). is returned).
If a \var{groupN} argument is zero, the corresponding return value is the If a \var{groupN} argument is zero, the corresponding return value is the
entire matching string; if it is in the inclusive range [1..99], it is entire matching string; if it is in the inclusive range [1..99], it is
......
...@@ -32,7 +32,8 @@ the file system itself. Rather, it calls methods of an \class{RHooks} ...@@ -32,7 +32,8 @@ the file system itself. Rather, it calls methods of an \class{RHooks}
instance that was passed to or created by its constructor. (Actually, instance that was passed to or created by its constructor. (Actually,
the \class{RExec} object doesn't make these calls --- they are made by the \class{RExec} object doesn't make these calls --- they are made by
a module loader object that's part of the \class{RExec} object. This a module loader object that's part of the \class{RExec} object. This
allows another level of flexibility, e.g. using packages.) allows another level of flexibility, which can be useful when changing
the mechanics of \keyword{import} within the restricted environment.)
By providing an alternate \class{RHooks} object, we can control the By providing an alternate \class{RHooks} object, we can control the
file system accesses made to import a module, without changing the file system accesses made to import a module, without changing the
...@@ -135,7 +136,7 @@ Reload the module object \var{module}, re-parsing and re-initializing it. ...@@ -135,7 +136,7 @@ Reload the module object \var{module}, re-parsing and re-initializing it.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}{r_unload}{module} \begin{methoddesc}{r_unload}{module}
Unload the module object \var{module} (i.e., remove it from the Unload the module object \var{module} (remove it from the
restricted environment's \code{sys.modules} dictionary). restricted environment's \code{sys.modules} dictionary).
\end{methoddesc} \end{methoddesc}
......
...@@ -57,7 +57,7 @@ If called for \var{text} that doesn't include a period character ...@@ -57,7 +57,7 @@ If called for \var{text} that doesn't include a period character
keywords (as defined by the \refmodule{keyword} module). keywords (as defined by the \refmodule{keyword} module).
If called for a dotted name, it will try to evaluate anything without If called for a dotted name, it will try to evaluate anything without
obvious side-effects (i.e., functions will not be evaluated, but it obvious side-effects (functions will not be evaluated, but it
can generate calls to \method{__getattr__()}) upto the last part, and can generate calls to \method{__getattr__()}) upto the last part, and
find matches for the rest via the \function{dir()} function. find matches for the rest via the \function{dir()} function.
\end{methoddesc} \end{methoddesc}
...@@ -42,7 +42,7 @@ An sha object has the same methods as md5 objects: ...@@ -42,7 +42,7 @@ An sha object has the same methods as md5 objects:
\begin{methoddesc}[sha]{update}{arg} \begin{methoddesc}[sha]{update}{arg}
Update the sha object with the string \var{arg}. Repeated calls are Update the sha object with the string \var{arg}. Repeated calls are
equivalent to a single call with the concatenation of all the equivalent to a single call with the concatenation of all the
arguments, i.e.\ \code{m.update(a); m.update(b)} is equivalent to arguments: \code{m.update(a); m.update(b)} is equivalent to
\code{m.update(a+b)}. \code{m.update(a+b)}.
\end{methoddesc} \end{methoddesc}
......
...@@ -12,7 +12,7 @@ Some general rules for working with signals and their handlers: ...@@ -12,7 +12,7 @@ Some general rules for working with signals and their handlers:
\item \item
A handler for a particular signal, once set, remains installed until A handler for a particular signal, once set, remains installed until
it is explicitly reset (i.e. Python emulates the BSD style interface it is explicitly reset (Python emulates the BSD style interface
regardless of the underlying implementation), with the exception of regardless of the underlying implementation), with the exception of
the handler for \constant{SIGCHLD}, which follows the underlying the handler for \constant{SIGCHLD}, which follows the underlying
implementation. implementation.
...@@ -25,8 +25,8 @@ sections (since this is not supported by all \UNIX{} flavors). ...@@ -25,8 +25,8 @@ sections (since this is not supported by all \UNIX{} flavors).
Although Python signal handlers are called asynchronously as far as Although Python signal handlers are called asynchronously as far as
the Python user is concerned, they can only occur between the the Python user is concerned, they can only occur between the
``atomic'' instructions of the Python interpreter. This means that ``atomic'' instructions of the Python interpreter. This means that
signals arriving during long calculations implemented purely in \C{} signals arriving during long calculations implemented purely in C
(e.g.\ regular expression matches on large bodies of text) may be (such as regular expression matches on large bodies of text) may be
delayed for an arbitrary amount of time. delayed for an arbitrary amount of time.
\item \item
...@@ -97,7 +97,7 @@ The \module{signal} module defines the following functions: ...@@ -97,7 +97,7 @@ The \module{signal} module defines the following functions:
\begin{funcdesc}{alarm}{time} \begin{funcdesc}{alarm}{time}
If \var{time} is non-zero, this function requests that a If \var{time} is non-zero, this function requests that a
\constant{SIGALRM} signal be sent to the process in \var{time} seconds. \constant{SIGALRM} signal be sent to the process in \var{time} seconds.
Any previously scheduled alarm is canceled (i.e.\ only one alarm can Any previously scheduled alarm is canceled (only one alarm can
be scheduled at any time). The returned value is then the number of be scheduled at any time). The returned value is then the number of
seconds before any previously set alarm was to have been delivered. seconds before any previously set alarm was to have been delivered.
If \var{time} is zero, no alarm id scheduled, and any scheduled If \var{time} is zero, no alarm id scheduled, and any scheduled
......
...@@ -445,7 +445,7 @@ Notes: ...@@ -445,7 +445,7 @@ Notes:
\var{s}). \var{s}).
\item[(2)] If \var{i} or \var{j} is negative, the index is relative to \item[(2)] If \var{i} or \var{j} is negative, the index is relative to
the end of the string, i.e., \code{len(\var{s}) + \var{i}} or the end of the string: \code{len(\var{s}) + \var{i}} or
\code{len(\var{s}) + \var{j}} is substituted. But note that \code{-0} is \code{len(\var{s}) + \var{j}} is substituted. But note that \code{-0} is
still \code{0}. still \code{0}.
...@@ -538,7 +538,7 @@ the string is not empty, false otherwise. ...@@ -538,7 +538,7 @@ the string is not empty, false otherwise.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{istitle}{} \begin{methoddesc}[string]{istitle}{}
Return true if the string is a titlecased string, i.e.\ uppercase Return true if the string is a titlecased string: uppercase
characters may only follow uncased characters and lowercase characters characters may only follow uncased characters and lowercase characters
only cased ones. Return false otherwise. only cased ones. Return false otherwise.
\end{methoddesc} \end{methoddesc}
...@@ -628,7 +628,7 @@ lowercase and vice versa. ...@@ -628,7 +628,7 @@ lowercase and vice versa.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[string]{title}{} \begin{methoddesc}[string]{title}{}
Return a titlecased version of, i.e.\ words start with uppercase Return a titlecased version of the string: words start with uppercase
characters, all remaining cased characters are lowercase. characters, all remaining cased characters are lowercase.
\end{methoddesc} \end{methoddesc}
...@@ -1008,7 +1008,7 @@ A special member of every module is \member{__dict__}. ...@@ -1008,7 +1008,7 @@ A special member of every module is \member{__dict__}.
This is the dictionary containing the module's symbol table. This is the dictionary containing the module's symbol table.
Modifying this dictionary will actually change the module's symbol Modifying this dictionary will actually change the module's symbol
table, but direct assignment to the \member{__dict__} attribute is not table, but direct assignment to the \member{__dict__} attribute is not
possible (i.e., you can write \code{\var{m}.__dict__['a'] = 1}, which possible (you can write \code{\var{m}.__dict__['a'] = 1}, which
defines \code{\var{m}.a} to be \code{1}, but you can't write defines \code{\var{m}.a} to be \code{1}, but you can't write
\code{\var{m}.__dict__ = \{\}}. \code{\var{m}.__dict__ = \{\}}.
...@@ -1087,7 +1087,7 @@ subclass of that class), otherwise a \code{TypeError} is raised. ...@@ -1087,7 +1087,7 @@ subclass of that class), otherwise a \code{TypeError} is raised.
Like function objects, methods objects support getting Like function objects, methods objects support getting
arbitrary attributes. However, since method attributes are actually arbitrary attributes. However, since method attributes are actually
stored on the underlying function object (i.e. \code{meth.im_func}), stored on the underlying function object (\code{meth.im_func}),
setting method attributes on either bound or unbound methods is setting method attributes on either bound or unbound methods is
disallowed. Attempting to set a method attribute results in a disallowed. Attempting to set a method attribute results in a
\code{TypeError} being raised. In order to set a method attribute, \code{TypeError} being raised. In order to set a method attribute,
...@@ -1167,7 +1167,7 @@ File objects are implemented using C's \code{stdio} package and can be ...@@ -1167,7 +1167,7 @@ File objects are implemented using C's \code{stdio} package and can be
created with the built-in function created with the built-in function
\function{open()}\bifuncindex{open} described in section \function{open()}\bifuncindex{open} described in section
\ref{built-in-funcs}, ``Built-in Functions.'' They are also returned \ref{built-in-funcs}, ``Built-in Functions.'' They are also returned
by some other built-in functions and methods, e.g., by some other built-in functions and methods, such as
\function{os.popen()} and \function{os.fdopen()} and the \function{os.popen()} and \function{os.fdopen()} and the
\method{makefile()} method of socket objects. \method{makefile()} method of socket objects.
\refstmodindex{os} \refstmodindex{os}
...@@ -1206,10 +1206,11 @@ Files have the following methods: ...@@ -1206,10 +1206,11 @@ Files have the following methods:
Return the integer ``file descriptor'' that is used by the Return the integer ``file descriptor'' that is used by the
underlying implementation to request I/O operations from the underlying implementation to request I/O operations from the
operating system. This can be useful for other, lower level operating system. This can be useful for other, lower level
interfaces that use file descriptors, e.g.\ module interfaces that use file descriptors, such as the
\refmodule{fcntl}\refbimodindex{fcntl} or \function{os.read()} and \refmodule{fcntl}\refbimodindex{fcntl} module or
friends. \strong{Note:} File-like objects which do not have a real \function{os.read()} and friends. \strong{Note:} File-like objects
file descriptor should \emph{not} provide this method! which do not have a real file descriptor should \emph{not} provide
this method!
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[file]{read}{\optional{size}} \begin{methoddesc}[file]{read}{\optional{size}}
...@@ -1229,7 +1230,7 @@ Files have the following methods: ...@@ -1229,7 +1230,7 @@ Files have the following methods:
kept in the string\footnote{ kept in the string\footnote{
The advantage of leaving the newline on is that an empty string The advantage of leaving the newline on is that an empty string
can be returned to mean \EOF{} without being ambiguous. Another can be returned to mean \EOF{} without being ambiguous. Another
advantage is that (in cases where it might matter, e.g. if you advantage is that (in cases where it might matter, for example. if you
want to make an exact copy of a file while scanning its lines) want to make an exact copy of a file while scanning its lines)
you can tell whether the last line of a file ended in a newline you can tell whether the last line of a file ended in a newline
or not (yes this happens!). or not (yes this happens!).
...@@ -1356,16 +1357,16 @@ object's (writable) attributes. ...@@ -1356,16 +1357,16 @@ object's (writable) attributes.
\end{memberdesc} \end{memberdesc}
\begin{memberdesc}[object]{__methods__} \begin{memberdesc}[object]{__methods__}
List of the methods of many built-in object types, List of the methods of many built-in object types. For example,
e.g., \code{[].__methods__} yields \code{[].__methods__} yields \code{['append', 'count', 'index',
\code{['append', 'count', 'index', 'insert', 'pop', 'remove', 'insert', 'pop', 'remove', 'reverse', 'sort']}. This usually does not
'reverse', 'sort']}. This usually does not need to be explicitly need to be explicitly provided by the object.
provided by the object.
\end{memberdesc} \end{memberdesc}
\begin{memberdesc}[object]{__members__} \begin{memberdesc}[object]{__members__}
Similar to \member{__methods__}, but lists data attributes. This Similar to \member{__methods__}, but lists data attributes. This
usually does not need to be explicitly provided by the object. usually does not need to be explicitly provided by the object, and
need not include the names of the attributes defined in this section.
\end{memberdesc} \end{memberdesc}
\begin{memberdesc}[instance]{__class__} \begin{memberdesc}[instance]{__class__}
...@@ -1373,5 +1374,6 @@ The class to which a class instance belongs. ...@@ -1373,5 +1374,6 @@ The class to which a class instance belongs.
\end{memberdesc} \end{memberdesc}
\begin{memberdesc}[class]{__bases__} \begin{memberdesc}[class]{__bases__}
The tuple of base classes of a class object. The tuple of base classes of a class object. If there are no base
classes, this will be an empty tuple.
\end{memberdesc} \end{memberdesc}
...@@ -17,7 +17,7 @@ If no string is given, the \class{StringIO} will start empty. ...@@ -17,7 +17,7 @@ If no string is given, the \class{StringIO} will start empty.
The \class{StringIO} object can accept either Unicode or 8-bit The \class{StringIO} object can accept either Unicode or 8-bit
strings, but mixing the two may take some care. If both are used, strings, but mixing the two may take some care. If both are used,
8-bit strings that cannot be interpreted as 7-bit \ASCII{} (i.e., that 8-bit strings that cannot be interpreted as 7-bit \ASCII{} (that
use the 8th bit) will cause a \exception{UnicodeError} to be raised use the 8th bit) will cause a \exception{UnicodeError} to be raised
when \method{getvalue()} is called. when \method{getvalue()} is called.
\end{classdesc} \end{classdesc}
......
...@@ -33,8 +33,8 @@ The module defines the following exception and functions: ...@@ -33,8 +33,8 @@ The module defines the following exception and functions:
Unpack the string (presumably packed by \code{pack(\var{fmt}, Unpack the string (presumably packed by \code{pack(\var{fmt},
\textrm{\ldots})}) according to the given format. The result is a \textrm{\ldots})}) according to the given format. The result is a
tuple even if it contains exactly one item. The string must contain tuple even if it contains exactly one item. The string must contain
exactly the amount of data required by the format (i.e. exactly the amount of data required by the format
\code{len(\var{string})} must equal \code{calcsize(\var{fmt})}). (\code{len(\var{string})} must equal \code{calcsize(\var{fmt})}).
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{calcsize}{fmt} \begin{funcdesc}{calcsize}{fmt}
...@@ -78,8 +78,8 @@ Notes: ...@@ -78,8 +78,8 @@ Notes:
\end{description} \end{description}
A format character may be preceded by an integral repeat count; A format character may be preceded by an integral repeat count. For
e.g.\ the format string \code{'4h'} means exactly the same as example, the format string \code{'4h'} means exactly the same as
\code{'hhhh'}. \code{'hhhh'}.
Whitespace characters between formats are ignored; a count and its Whitespace characters between formats are ignored; a count and its
...@@ -87,7 +87,7 @@ format must not contain whitespace though. ...@@ -87,7 +87,7 @@ format must not contain whitespace though.
For the \character{s} format character, the count is interpreted as the For the \character{s} format character, the count is interpreted as the
size of the string, not a repeat count like for the other format size of the string, not a repeat count like for the other format
characters; e.g. \code{'10s'} means a single 10-byte string, while characters; for example, \code{'10s'} means a single 10-byte string, while
\code{'10c'} means 10 characters. For packing, the string is \code{'10c'} means 10 characters. For packing, the string is
truncated or padded with null bytes as appropriate to make it fit. truncated or padded with null bytes as appropriate to make it fit.
For unpacking, the resulting string always has exactly the specified For unpacking, the resulting string always has exactly the specified
...@@ -133,8 +133,8 @@ according to the following table: ...@@ -133,8 +133,8 @@ according to the following table:
If the first character is not one of these, \character{@} is assumed. If the first character is not one of these, \character{@} is assumed.
Native byte order is big-endian or little-endian, depending on the Native byte order is big-endian or little-endian, depending on the
host system (e.g. Motorola and Sun are big-endian; Intel and DEC are host system. For example, Motorola and Sun processors are big-endian;
little-endian). Intel and DEC processors are little-endian.
Native size and alignment are determined using the C compiler's Native size and alignment are determined using the C compiler's
\keyword{sizeof} expression. This is always combined with native byte \keyword{sizeof} expression. This is always combined with native byte
...@@ -156,7 +156,7 @@ The form \character{!} is available for those poor souls who claim they ...@@ -156,7 +156,7 @@ The form \character{!} is available for those poor souls who claim they
can't remember whether network byte order is big-endian or can't remember whether network byte order is big-endian or
little-endian. little-endian.
There is no way to indicate non-native byte order (i.e. force There is no way to indicate non-native byte order (force
byte-swapping); use the appropriate choice of \character{<} or byte-swapping); use the appropriate choice of \character{<} or
\character{>}. \character{>}.
...@@ -182,10 +182,10 @@ big-endian machine): ...@@ -182,10 +182,10 @@ big-endian machine):
Hint: to align the end of a structure to the alignment requirement of Hint: to align the end of a structure to the alignment requirement of
a particular type, end the format with the code for that type with a a particular type, end the format with the code for that type with a
repeat count of zero, e.g.\ the format \code{'llh0l'} specifies two repeat count of zero. For example, the format \code{'llh0l'}
pad bytes at the end, assuming longs are aligned on 4-byte boundaries. specifies two pad bytes at the end, assuming longs are aligned on
This only works when native size and alignment are in effect; 4-byte boundaries. This only works when native size and alignment are
standard size and alignment does not enforce any alignment. in effect; standard size and alignment does not enforce any alignment.
\begin{seealso} \begin{seealso}
\seemodule{array}{Packed binary storage of homogeneous data.} \seemodule{array}{Packed binary storage of homogeneous data.}
......
...@@ -150,10 +150,11 @@ state, no thread owns it. ...@@ -150,10 +150,11 @@ state, no thread owns it.
To lock the lock, a thread calls its \method{acquire()} method; this To lock the lock, a thread calls its \method{acquire()} method; this
returns once the thread owns the lock. To unlock the lock, a returns once the thread owns the lock. To unlock the lock, a
thread calls its \method{release()} method. \method{acquire()}/\method{release()} call pairs thread calls its \method{release()} method.
may be nested; only the final \method{release()} (i.e. the \method{release()} of the \method{acquire()}/\method{release()} call pairs may be nested; only
outermost pair) resets the lock to unlocked and allows another the final \method{release()} (the \method{release()} of the outermost
thread blocked in \method{acquire()} to proceed. pair) resets the lock to unlocked and allows another thread blocked in
\method{acquire()} to proceed.
\begin{methoddesc}{acquire}{\optional{blocking\code{ = 1}}} \begin{methoddesc}{acquire}{\optional{blocking\code{ = 1}}}
Acquire a lock, blocking or non-blocking. Acquire a lock, blocking or non-blocking.
...@@ -453,7 +454,7 @@ daemon thread. ...@@ -453,7 +454,7 @@ daemon thread.
There is the possibility that ``dummy thread objects'' are There is the possibility that ``dummy thread objects'' are
created. These are thread objects corresponding to ``alien created. These are thread objects corresponding to ``alien
threads''. These are threads of control started outside the threads''. These are threads of control started outside the
threading module, e.g. directly from C code. Dummy thread objects threading module, such as directly from C code. Dummy thread objects
have limited functionality; they are always considered alive, have limited functionality; they are always considered alive,
active, and daemonic, and cannot be \method{join()}ed. They are never active, and daemonic, and cannot be \method{join()}ed. They are never
deleted, since it is impossible to detect the termination of alien deleted, since it is impossible to detect the termination of alien
......
...@@ -80,7 +80,7 @@ The time tuple as returned by \function{gmtime()}, ...@@ -80,7 +80,7 @@ The time tuple as returned by \function{gmtime()},
is a tuple of 9 integers: is a tuple of 9 integers:
\begin{tableiii}{r|l|l}{textrm}{Index}{Field}{Values} \begin{tableiii}{r|l|l}{textrm}{Index}{Field}{Values}
\lineiii{0}{year}{(e.g.\ 1993)} \lineiii{0}{year}{(for example, 1993)}
\lineiii{1}{month}{range [1,12]} \lineiii{1}{month}{range [1,12]}
\lineiii{2}{day}{range [1,31]} \lineiii{2}{day}{range [1,31]}
\lineiii{3}{hour}{range [0,23]} \lineiii{3}{hour}{range [0,23]}
...@@ -285,8 +285,8 @@ precision than 1 second. ...@@ -285,8 +285,8 @@ precision than 1 second.
\begin{datadesc}{timezone} \begin{datadesc}{timezone}
The offset of the local (non-DST) timezone, in seconds west of UTC The offset of the local (non-DST) timezone, in seconds west of UTC
(i.e. negative in most of Western Europe, positive in the US, zero in (negative in most of Western Europe, positive in the US, zero in the
the UK). UK).
\end{datadesc} \end{datadesc}
\begin{datadesc}{tzname} \begin{datadesc}{tzname}
......
...@@ -24,7 +24,7 @@ import user ...@@ -24,7 +24,7 @@ import user
The \module{user} module looks for a file \file{.pythonrc.py} in the user's The \module{user} module looks for a file \file{.pythonrc.py} in the user's
home directory and if it can be opened, executes it (using home directory and if it can be opened, executes it (using
\function{execfile()}\bifuncindex{execfile}) in its own (i.e. the \function{execfile()}\bifuncindex{execfile}) in its own (the
module \module{user}'s) global namespace. Errors during this phase module \module{user}'s) global namespace. Errors during this phase
are not caught; that's up to the program that imports the are not caught; that's up to the program that imports the
\module{user} module, if it wishes. The home directory is assumed to \module{user} module, if it wishes. The home directory is assumed to
......
...@@ -380,8 +380,8 @@ This module offers the following functions: ...@@ -380,8 +380,8 @@ This module offers the following functions:
if handle: if handle:
print "Yes" print "Yes"
\end{verbatim} \end{verbatim}
will print \code{Yes} if the handle is currently valid (i.e., will print \code{Yes} if the handle is currently valid (has not been
has not been closed or detached). closed or detached).
The object also support comparison semantics, so handle The object also support comparison semantics, so handle
objects will compare true if they both reference the same objects will compare true if they both reference the same
......
...@@ -267,7 +267,7 @@ Namespaces proposed recommendation. ...@@ -267,7 +267,7 @@ Namespaces proposed recommendation.
Tag and attribute names that are defined in an XML namespace are Tag and attribute names that are defined in an XML namespace are
handled as if the name of the tag or element consisted of the handled as if the name of the tag or element consisted of the
namespace (i.e. the URL that defines the namespace) followed by a namespace (the URL that defines the namespace) followed by a
space and the name of the tag or attribute. For instance, the tag space and the name of the tag or attribute. For instance, the tag
\code{<html xmlns='http://www.w3.org/TR/REC-html40'>} is treated as if \code{<html xmlns='http://www.w3.org/TR/REC-html40'>} is treated as if
the tag name was \code{'http://www.w3.org/TR/REC-html40 html'}, and the tag name was \code{'http://www.w3.org/TR/REC-html40 html'}, and
......
...@@ -79,7 +79,7 @@ The available attributes of this module are: ...@@ -79,7 +79,7 @@ The available attributes of this module are:
\begin{classdesc}{ZipFile}{file\optional{, mode\optional{, compression}}} \begin{classdesc}{ZipFile}{file\optional{, mode\optional{, compression}}}
Open a ZIP file, where \var{file} can be either a path to a file Open a ZIP file, where \var{file} can be either a path to a file
(i.e. a string) or a file-like object. The \var{mode} parameter (a string) or a file-like object. The \var{mode} parameter
should be \code{'r'} to read an existing file, \code{'w'} to should be \code{'r'} to read an existing file, \code{'w'} to
truncate and write a new file, or \code{'a'} to append to an truncate and write a new file, or \code{'a'} to append to an
existing file. For \var{mode} is \code{'a'} and \var{file} existing file. For \var{mode} is \code{'a'} and \var{file}
......
...@@ -92,7 +92,7 @@ The \class{XMLReader} interface supports the following methods: ...@@ -92,7 +92,7 @@ The \class{XMLReader} interface supports the following methods:
\begin{methoddesc}[XMLReader]{parse}{source} \begin{methoddesc}[XMLReader]{parse}{source}
Process an input source, producing SAX events. The \var{source} Process an input source, producing SAX events. The \var{source}
object can be a system identifier (i.e. a string identifying the object can be a system identifier (a string identifying the
input source -- typically a file name or an URL), a file-like input source -- typically a file name or an URL), a file-like
object, or an \class{InputSource} object. When \method{parse()} object, or an \class{InputSource} object. When \method{parse()}
returns, the input is completely processed, and the parser object returns, the input is completely processed, and the parser object
......
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