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.
This commit is contained in:
parent
19b1c6156b
commit
907e76b620
|
@ -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
|
||||
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,
|
||||
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
|
||||
the same format (which happens to have originated with the
|
||||
\POSIX{} interface).
|
||||
|
@ -42,9 +42,9 @@ directly from the \module{os} module.
|
|||
|
||||
|
||||
\begin{excdesc}{error}
|
||||
This exception is raised when a function returns a
|
||||
system-related error (e.g., not for illegal argument types). This is
|
||||
also known as the built-in exception \exception{OSError}. The
|
||||
This exception is raised when a function returns a system-related
|
||||
error (not for illegal argument types or other incidental errors).
|
||||
This is also known as the built-in exception \exception{OSError}. The
|
||||
accompanying value is a pair containing the numeric error code from
|
||||
\cdata{errno} and the corresponding string, as would be printed by the
|
||||
C function \cfunction{perror()}. See the module
|
||||
|
@ -55,7 +55,7 @@ When exceptions are classes, this exception carries two attributes,
|
|||
\member{errno} and \member{strerror}. The first holds the value of
|
||||
the C \cdata{errno} variable, and the latter holds the corresponding
|
||||
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
|
||||
attribute, \member{filename}, which is the file name passed to the
|
||||
function.
|
||||
|
@ -72,10 +72,11 @@ have currently been registered: \code{'posix'}, \code{'nt'},
|
|||
|
||||
\begin{datadesc}{path}
|
||||
The corresponding OS dependent standard module for pathname
|
||||
operations, e.g., \module{posixpath} or \module{macpath}. Thus, given
|
||||
the proper imports, \code{os.path.split(\var{file})} is equivalent to but
|
||||
more portable than \code{posixpath.split(\var{file})}. Note that this
|
||||
is also a valid module: it may be imported directly as
|
||||
operations, such as \module{posixpath} or \module{macpath}. Thus,
|
||||
given the proper imports, \code{os.path.split(\var{file})} is
|
||||
equivalent to but more portable than
|
||||
\code{posixpath.split(\var{file})}. Note that this is also an
|
||||
importable module: it may be imported directly as
|
||||
\refmodule{os.path}.
|
||||
\end{datadesc}
|
||||
|
||||
|
@ -858,15 +859,15 @@ Availability: \UNIX{}, Windows.
|
|||
|
||||
\begin{funcdesc}{execv}{path, 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.
|
||||
Availability: \UNIX{}, Windows.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{execve}{path, args, env}
|
||||
Execute the executable \var{path} with argument list \var{args},
|
||||
and environment \var{env},
|
||||
replacing the current process (i.e., the Python interpreter).
|
||||
and environment \var{env}, replacing the current process (the Python
|
||||
interpreter).
|
||||
The argument list may be a tuple or list of strings.
|
||||
The environment must be a dictionary mapping strings to strings.
|
||||
Availability: \UNIX{}, Windows.
|
||||
|
@ -1150,20 +1151,20 @@ Higher-level operations on pathnames are defined in the
|
|||
|
||||
|
||||
\begin{datadesc}{curdir}
|
||||
The constant string used by the OS to refer to the current directory,
|
||||
e.g.\ \code{'.'} for \POSIX{} or \code{':'} for the Macintosh.
|
||||
The constant string used by the OS to refer to the current directory.
|
||||
For example: \code{'.'} for \POSIX{} or \code{':'} for the Macintosh.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{pardir}
|
||||
The constant string used by the OS to refer to the parent directory,
|
||||
e.g.\ \code{'..'} for \POSIX{} or \code{'::'} for the Macintosh.
|
||||
The constant string used by the OS to refer to the parent directory.
|
||||
For example: \code{'..'} for \POSIX{} or \code{'::'} for the Macintosh.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{sep}
|
||||
The character used by the OS to separate pathname components,
|
||||
e.g.\ \character{/} for \POSIX{} or \character{:} for the Macintosh.
|
||||
Note that knowing this is not sufficient to be able to parse or
|
||||
concatenate pathnames --- use \function{os.path.split()} and
|
||||
for example, \character{/} for \POSIX{} or \character{:} for the
|
||||
Macintosh. Note that knowing this is not sufficient to be able to
|
||||
parse or concatenate pathnames --- use \function{os.path.split()} and
|
||||
\function{os.path.join()} --- but it is occasionally useful.
|
||||
\end{datadesc}
|
||||
|
||||
|
@ -1175,7 +1176,7 @@ or \code{None} if only one separator character exists. This is set to
|
|||
|
||||
\begin{datadesc}{pathsep}
|
||||
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.
|
||||
\end{datadesc}
|
||||
|
||||
|
@ -1186,7 +1187,7 @@ doesn't have a \code{'PATH'} key.
|
|||
|
||||
\begin{datadesc}{linesep}
|
||||
The string used to separate (or, rather, terminate) lines on the
|
||||
current platform. This may be a single character,
|
||||
e.g.\ \code{'\e n'} for \POSIX{} or \code{'\e r'} for MacOS, or multiple
|
||||
characters, e.g.\ \code{'\e r\e n'} for MS-DOS and MS Windows.
|
||||
current platform. This may be a single character, such as \code{'\e
|
||||
n'} for \POSIX{} or \code{'\e r'} for MacOS, or multiple characters,
|
||||
for example, \code{'\e r\e n'} for MS-DOS and MS Windows.
|
||||
\end{datadesc}
|
||||
|
|
|
@ -319,8 +319,8 @@ made in calls to sub-functions),
|
|||
is the quotient of \code{tottime} divided by \code{ncalls}
|
||||
|
||||
\item[cumtime ]
|
||||
is the total time spent in this and all subfunctions (i.e., from
|
||||
invocation till exit). This figure is accurate \emph{even} for recursive
|
||||
is the total time spent in this and all subfunctions (from invocation
|
||||
till exit). This figure is accurate \emph{even} for recursive
|
||||
functions.
|
||||
|
||||
\item[percall ]
|
||||
|
@ -331,11 +331,11 @@ provides the respective data of each function
|
|||
|
||||
\end{description}
|
||||
|
||||
When there are two numbers in the first column (e.g.: \samp{43/3}),
|
||||
then the latter is the number of primitive calls, and the former is
|
||||
the actual number of calls. Note that when the function does not
|
||||
recurse, these two values are the same, and only the single figure is
|
||||
printed.
|
||||
When there are two numbers in the first column (for example,
|
||||
\samp{43/3}), then the latter is the number of primitive calls, and
|
||||
the former is the actual number of calls. Note that when the function
|
||||
does not recurse, these two values are the same, and only the single
|
||||
figure is printed.
|
||||
|
||||
\end{funcdesc}
|
||||
|
||||
|
@ -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
|
||||
\emph{no} file compatibility guaranteed with future versions of this
|
||||
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
|
||||
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
|
|||
performing a strip operation, the object is considered to have its
|
||||
entries in a ``random'' order, as it was just after object
|
||||
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
|
||||
statistics for these two entries are accumulated into a single entry.
|
||||
\end{methoddesc}
|
||||
|
@ -423,7 +423,7 @@ defined:
|
|||
|
||||
Note that all sorts on statistics are in descending order (placing
|
||||
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
|
||||
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
|
||||
|
@ -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
|
||||
times, or call many functions, will typically accumulate this error.
|
||||
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
|
||||
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
|
||||
square sense), but it will sometimes produce negative numbers (when
|
||||
call counts are exceptionally low, and the gods of probability work
|
||||
|
@ -695,8 +695,8 @@ class MyProfiler(Profile):
|
|||
|
||||
The following derived profiler simulates the old style profiler,
|
||||
providing errant results on recursive functions. The reason for the
|
||||
usefulness of this profiler is that it runs faster (i.e., less
|
||||
overhead) than the old profiler. It still creates all the caller
|
||||
usefulness of this profiler is that it runs faster (less
|
||||
overhead) than the new profiler. It still creates all the caller
|
||||
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
|
||||
it does not charge all its overhead time to the user's code.
|
||||
|
|
|
@ -229,9 +229,10 @@ referenced as the numbered group 1.
|
|||
|
||||
For example, if the pattern is
|
||||
\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')}
|
||||
or \code{m.end('id')}, and also by name in pattern text
|
||||
(e.g. \regexp{(?P=id)}) and replacement text (e.g. \code{\e g<id>}).
|
||||
name in arguments to methods of match objects, such as
|
||||
\code{m.group('id')} or \code{m.end('id')}, and also by name in
|
||||
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
|
||||
earlier group named \var{name}.
|
||||
|
@ -516,7 +517,7 @@ replacement string. For example:
|
|||
|
||||
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
|
||||
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'}.
|
||||
|
||||
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
|
|||
|
||||
\begin{excdesc}{error}
|
||||
Exception raised when a string passed to one of the functions here
|
||||
is not a valid regular expression (e.g., unmatched parentheses) or
|
||||
when some other error occurs during compilation or matching. It is
|
||||
never an error if a string contains no match for a pattern.
|
||||
is not a valid regular expression (for example, it might contain
|
||||
unmatched parentheses) or when some other error occurs during
|
||||
compilation or matching. It is never an error if a string contains
|
||||
no match for a pattern.
|
||||
\end{excdesc}
|
||||
|
||||
|
||||
|
@ -654,7 +656,7 @@ corresponding group.
|
|||
Returns one or more subgroups of the match. If there is a single
|
||||
argument, the result is a single string; if there are
|
||||
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).
|
||||
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
|
||||
|
|
|
@ -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,
|
||||
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
|
||||
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
|
||||
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.
|
|||
\end{methoddesc}
|
||||
|
||||
\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).
|
||||
\end{methoddesc}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ If called for \var{text} that doesn't include a period character
|
|||
keywords (as defined by the \refmodule{keyword} module).
|
||||
|
||||
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
|
||||
find matches for the rest via the \function{dir()} function.
|
||||
\end{methoddesc}
|
||||
|
|
|
@ -42,7 +42,7 @@ An sha object has the same methods as md5 objects:
|
|||
\begin{methoddesc}[sha]{update}{arg}
|
||||
Update the sha object with the string \var{arg}. Repeated calls are
|
||||
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)}.
|
||||
\end{methoddesc}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ Some general rules for working with signals and their handlers:
|
|||
|
||||
\item
|
||||
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
|
||||
the handler for \constant{SIGCHLD}, which follows the underlying
|
||||
implementation.
|
||||
|
@ -25,8 +25,8 @@ sections (since this is not supported by all \UNIX{} flavors).
|
|||
Although Python signal handlers are called asynchronously as far as
|
||||
the Python user is concerned, they can only occur between the
|
||||
``atomic'' instructions of the Python interpreter. This means that
|
||||
signals arriving during long calculations implemented purely in \C{}
|
||||
(e.g.\ regular expression matches on large bodies of text) may be
|
||||
signals arriving during long calculations implemented purely in C
|
||||
(such as regular expression matches on large bodies of text) may be
|
||||
delayed for an arbitrary amount of time.
|
||||
|
||||
\item
|
||||
|
@ -97,7 +97,7 @@ The \module{signal} module defines the following functions:
|
|||
\begin{funcdesc}{alarm}{time}
|
||||
If \var{time} is non-zero, this function requests that a
|
||||
\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
|
||||
seconds before any previously set alarm was to have been delivered.
|
||||
If \var{time} is zero, no alarm id scheduled, and any scheduled
|
||||
|
|
|
@ -445,7 +445,7 @@ Notes:
|
|||
\var{s}).
|
||||
|
||||
\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
|
||||
still \code{0}.
|
||||
|
||||
|
@ -538,7 +538,7 @@ the string is not empty, false otherwise.
|
|||
\end{methoddesc}
|
||||
|
||||
\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
|
||||
only cased ones. Return false otherwise.
|
||||
\end{methoddesc}
|
||||
|
@ -628,7 +628,7 @@ lowercase and vice versa.
|
|||
\end{methoddesc}
|
||||
|
||||
\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.
|
||||
\end{methoddesc}
|
||||
|
||||
|
@ -1008,7 +1008,7 @@ A special member of every module is \member{__dict__}.
|
|||
This is the dictionary containing the module's symbol table.
|
||||
Modifying this dictionary will actually change the module's symbol
|
||||
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
|
||||
\code{\var{m}.__dict__ = \{\}}.
|
||||
|
||||
|
@ -1087,7 +1087,7 @@ subclass of that class), otherwise a \code{TypeError} is raised.
|
|||
|
||||
Like function objects, methods objects support getting
|
||||
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
|
||||
disallowed. Attempting to set a method attribute results in a
|
||||
\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
|
|||
created with the built-in function
|
||||
\function{open()}\bifuncindex{open} described in section
|
||||
\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
|
||||
\method{makefile()} method of socket objects.
|
||||
\refstmodindex{os}
|
||||
|
@ -1206,10 +1206,11 @@ Files have the following methods:
|
|||
Return the integer ``file descriptor'' that is used by the
|
||||
underlying implementation to request I/O operations from the
|
||||
operating system. This can be useful for other, lower level
|
||||
interfaces that use file descriptors, e.g.\ module
|
||||
\refmodule{fcntl}\refbimodindex{fcntl} or \function{os.read()} and
|
||||
friends. \strong{Note:} File-like objects which do not have a real
|
||||
file descriptor should \emph{not} provide this method!
|
||||
interfaces that use file descriptors, such as the
|
||||
\refmodule{fcntl}\refbimodindex{fcntl} module or
|
||||
\function{os.read()} and friends. \strong{Note:} File-like objects
|
||||
which do not have a real file descriptor should \emph{not} provide
|
||||
this method!
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[file]{read}{\optional{size}}
|
||||
|
@ -1229,7 +1230,7 @@ Files have the following methods:
|
|||
kept in the string\footnote{
|
||||
The advantage of leaving the newline on is that an empty string
|
||||
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)
|
||||
you can tell whether the last line of a file ended in a newline
|
||||
or not (yes this happens!).
|
||||
|
@ -1356,16 +1357,16 @@ object's (writable) attributes.
|
|||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[object]{__methods__}
|
||||
List of the methods of many built-in object types,
|
||||
e.g., \code{[].__methods__} yields
|
||||
\code{['append', 'count', 'index', 'insert', 'pop', 'remove',
|
||||
'reverse', 'sort']}. This usually does not need to be explicitly
|
||||
provided by the object.
|
||||
List of the methods of many built-in object types. For example,
|
||||
\code{[].__methods__} yields \code{['append', 'count', 'index',
|
||||
'insert', 'pop', 'remove', 'reverse', 'sort']}. This usually does not
|
||||
need to be explicitly provided by the object.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[object]{__members__}
|
||||
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}
|
||||
|
||||
\begin{memberdesc}[instance]{__class__}
|
||||
|
@ -1373,5 +1374,6 @@ The class to which a class instance belongs.
|
|||
\end{memberdesc}
|
||||
|
||||
\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}
|
||||
|
|
|
@ -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
|
||||
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
|
||||
when \method{getvalue()} is called.
|
||||
\end{classdesc}
|
||||
|
|
|
@ -33,8 +33,8 @@ The module defines the following exception and functions:
|
|||
Unpack the string (presumably packed by \code{pack(\var{fmt},
|
||||
\textrm{\ldots})}) according to the given format. The result is a
|
||||
tuple even if it contains exactly one item. The string must contain
|
||||
exactly the amount of data required by the format (i.e.
|
||||
\code{len(\var{string})} must equal \code{calcsize(\var{fmt})}).
|
||||
exactly the amount of data required by the format
|
||||
(\code{len(\var{string})} must equal \code{calcsize(\var{fmt})}).
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{calcsize}{fmt}
|
||||
|
@ -78,8 +78,8 @@ Notes:
|
|||
\end{description}
|
||||
|
||||
|
||||
A format character may be preceded by an integral repeat count;
|
||||
e.g.\ the format string \code{'4h'} means exactly the same as
|
||||
A format character may be preceded by an integral repeat count. For
|
||||
example, the format string \code{'4h'} means exactly the same as
|
||||
\code{'hhhh'}.
|
||||
|
||||
Whitespace characters between formats are ignored; a count and its
|
||||
|
@ -87,7 +87,7 @@ format must not contain whitespace though.
|
|||
|
||||
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
|
||||
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
|
||||
truncated or padded with null bytes as appropriate to make it fit.
|
||||
For unpacking, the resulting string always has exactly the specified
|
||||
|
@ -133,8 +133,8 @@ according to the following table:
|
|||
If the first character is not one of these, \character{@} is assumed.
|
||||
|
||||
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
|
||||
little-endian).
|
||||
host system. For example, Motorola and Sun processors are big-endian;
|
||||
Intel and DEC processors are little-endian.
|
||||
|
||||
Native size and alignment are determined using the C compiler's
|
||||
\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
|
|||
can't remember whether network byte order is big-endian or
|
||||
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
|
||||
\character{>}.
|
||||
|
||||
|
@ -182,10 +182,10 @@ big-endian machine):
|
|||
|
||||
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
|
||||
repeat count of zero, e.g.\ the format \code{'llh0l'} specifies two
|
||||
pad bytes at the end, assuming longs are aligned on 4-byte boundaries.
|
||||
This only works when native size and alignment are in effect;
|
||||
standard size and alignment does not enforce any alignment.
|
||||
repeat count of zero. For example, the format \code{'llh0l'}
|
||||
specifies two pad bytes at the end, assuming longs are aligned on
|
||||
4-byte boundaries. This only works when native size and alignment are
|
||||
in effect; standard size and alignment does not enforce any alignment.
|
||||
|
||||
\begin{seealso}
|
||||
\seemodule{array}{Packed binary storage of homogeneous data.}
|
||||
|
|
|
@ -150,10 +150,11 @@ state, no thread owns it.
|
|||
|
||||
To lock the lock, a thread calls its \method{acquire()} method; this
|
||||
returns once the thread owns the lock. To unlock the lock, a
|
||||
thread calls its \method{release()} method. \method{acquire()}/\method{release()} call pairs
|
||||
may be nested; only the final \method{release()} (i.e. the \method{release()} of the
|
||||
outermost pair) resets the lock to unlocked and allows another
|
||||
thread blocked in \method{acquire()} to proceed.
|
||||
thread calls its \method{release()} method.
|
||||
\method{acquire()}/\method{release()} call pairs may be nested; only
|
||||
the final \method{release()} (the \method{release()} of the outermost
|
||||
pair) resets the lock to unlocked and allows another thread blocked in
|
||||
\method{acquire()} to proceed.
|
||||
|
||||
\begin{methoddesc}{acquire}{\optional{blocking\code{ = 1}}}
|
||||
Acquire a lock, blocking or non-blocking.
|
||||
|
@ -453,7 +454,7 @@ daemon thread.
|
|||
There is the possibility that ``dummy thread objects'' are
|
||||
created. These are thread objects corresponding to ``alien
|
||||
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,
|
||||
active, and daemonic, and cannot be \method{join()}ed. They are never
|
||||
deleted, since it is impossible to detect the termination of alien
|
||||
|
|
|
@ -80,7 +80,7 @@ The time tuple as returned by \function{gmtime()},
|
|||
is a tuple of 9 integers:
|
||||
|
||||
\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{2}{day}{range [1,31]}
|
||||
\lineiii{3}{hour}{range [0,23]}
|
||||
|
@ -285,8 +285,8 @@ precision than 1 second.
|
|||
|
||||
\begin{datadesc}{timezone}
|
||||
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
|
||||
the UK).
|
||||
(negative in most of Western Europe, positive in the US, zero in the
|
||||
UK).
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{tzname}
|
||||
|
|
|
@ -24,7 +24,7 @@ import user
|
|||
|
||||
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
|
||||
\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
|
||||
are not caught; that's up to the program that imports the
|
||||
\module{user} module, if it wishes. The home directory is assumed to
|
||||
|
|
|
@ -380,8 +380,8 @@ This module offers the following functions:
|
|||
if handle:
|
||||
print "Yes"
|
||||
\end{verbatim}
|
||||
will print \code{Yes} if the handle is currently valid (i.e.,
|
||||
has not been closed or detached).
|
||||
will print \code{Yes} if the handle is currently valid (has not been
|
||||
closed or detached).
|
||||
|
||||
The object also support comparison semantics, so handle
|
||||
objects will compare true if they both reference the same
|
||||
|
|
|
@ -267,7 +267,7 @@ Namespaces proposed recommendation.
|
|||
|
||||
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
|
||||
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
|
||||
\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
|
||||
|
|
|
@ -79,7 +79,7 @@ The available attributes of this module are:
|
|||
|
||||
\begin{classdesc}{ZipFile}{file\optional{, mode\optional{, compression}}}
|
||||
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
|
||||
truncate and write a new file, or \code{'a'} to append to an
|
||||
existing file. For \var{mode} is \code{'a'} and \var{file}
|
||||
|
|
|
@ -92,7 +92,7 @@ The \class{XMLReader} interface supports the following methods:
|
|||
|
||||
\begin{methoddesc}[XMLReader]{parse}{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
|
||||
object, or an \class{InputSource} object. When \method{parse()}
|
||||
returns, the input is completely processed, and the parser object
|
||||
|
|
Loading…
Reference in New Issue