copyright.tex: Add 1995 to copyright message.
lib.tex: add libimp; remove bogus warning about lineii. libmath.tex: document hypot(). libmd5.tex: rename md5.md5() to md5.new(). libposix.tex: document chown(). libposixfile.tex: openfile() instead of fileopen(). libsocket.tex: document gethostbyaddr(). libtypes.tex: add footnote explaining why readline() keeps the newline. ref3.tex: correct typos, add back*quotes to index. ref4.tex: don't use \verb inside footnote. ref5.tex: explain repr() and str() and add them + back*quotes to index. ref6.tex: correct typo, don't use \verb in footnote. ref7.tex: don't use \verb in footnote.
This commit is contained in:
parent
e5f8b60429
commit
31cce97374
|
@ -1,5 +1,5 @@
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
|
@ -50,6 +50,7 @@ language.
|
||||||
\input{libmods} % Built-in modules
|
\input{libmods} % Built-in modules
|
||||||
\input{libsys}
|
\input{libsys}
|
||||||
\input{libbltin} % really __builtin__
|
\input{libbltin} % really __builtin__
|
||||||
|
\input{libimp}
|
||||||
\input{libmain} % really __main__
|
\input{libmain} % really __main__
|
||||||
\input{libarray}
|
\input{libarray}
|
||||||
\input{libmath}
|
\input{libmath}
|
||||||
|
@ -73,7 +74,7 @@ language.
|
||||||
\input{libgdbm}
|
\input{libgdbm}
|
||||||
\input{libgrp}
|
\input{libgrp}
|
||||||
\input{libposix}
|
\input{libposix}
|
||||||
\input{libposixfile} % XXX this uses lineii which partparse.py doesn't know
|
\input{libposixfile}
|
||||||
\input{libppath} % really posixpath
|
\input{libppath} % really posixpath
|
||||||
\input{libpwd}
|
\input{libpwd}
|
||||||
\input{libselect}
|
\input{libselect}
|
||||||
|
|
|
@ -50,6 +50,7 @@ language.
|
||||||
\input{libmods} % Built-in modules
|
\input{libmods} % Built-in modules
|
||||||
\input{libsys}
|
\input{libsys}
|
||||||
\input{libbltin} % really __builtin__
|
\input{libbltin} % really __builtin__
|
||||||
|
\input{libimp}
|
||||||
\input{libmain} % really __main__
|
\input{libmain} % really __main__
|
||||||
\input{libarray}
|
\input{libarray}
|
||||||
\input{libmath}
|
\input{libmath}
|
||||||
|
@ -73,7 +74,7 @@ language.
|
||||||
\input{libgdbm}
|
\input{libgdbm}
|
||||||
\input{libgrp}
|
\input{libgrp}
|
||||||
\input{libposix}
|
\input{libposix}
|
||||||
\input{libposixfile} % XXX this uses lineii which partparse.py doesn't know
|
\input{libposixfile}
|
||||||
\input{libppath} % really posixpath
|
\input{libppath} % really posixpath
|
||||||
\input{libpwd}
|
\input{libpwd}
|
||||||
\input{libselect}
|
\input{libselect}
|
||||||
|
|
|
@ -44,6 +44,7 @@ They are:
|
||||||
\code{floor(\varvars{x})},
|
\code{floor(\varvars{x})},
|
||||||
\code{fmod(\varvars{x\, y})},
|
\code{fmod(\varvars{x\, y})},
|
||||||
\code{frexp(\varvars{x})},
|
\code{frexp(\varvars{x})},
|
||||||
|
\code{hypot(\varvars{x\, y})},
|
||||||
\code{ldexp(\varvars{x\, y})},
|
\code{ldexp(\varvars{x\, y})},
|
||||||
\code{log(\varvars{x})},
|
\code{log(\varvars{x})},
|
||||||
\code{log10(\varvars{x})},
|
\code{log10(\varvars{x})},
|
||||||
|
@ -61,6 +62,9 @@ pattern than their C equivalents: they take a single argument and
|
||||||
return a pair of values, rather than returning their second return
|
return a pair of values, rather than returning their second return
|
||||||
value through an `output parameter' (there is no such thing in Python).
|
value through an `output parameter' (there is no such thing in Python).
|
||||||
|
|
||||||
|
The \code{hypot} function, which is not standard C, is not available
|
||||||
|
on all platforms.
|
||||||
|
|
||||||
The module also defines two mathematical constants:
|
The module also defines two mathematical constants:
|
||||||
\iftexi
|
\iftexi
|
||||||
\begin{datadesc}{pi}
|
\begin{datadesc}{pi}
|
||||||
|
|
|
@ -15,8 +15,8 @@ example will be helpful:
|
||||||
to obtain the digest of the string \code{'abc'}, use \ldots
|
to obtain the digest of the string \code{'abc'}, use \ldots
|
||||||
|
|
||||||
\bcode\begin{verbatim}
|
\bcode\begin{verbatim}
|
||||||
>>> from md5 import md5
|
>>> import md5
|
||||||
>>> m = md5()
|
>>> m = md5.new()
|
||||||
>>> m.update('abc')
|
>>> m.update('abc')
|
||||||
>>> m.digest()
|
>>> m.digest()
|
||||||
'\220\001P\230<\322O\260\326\226?}(\341\177r'
|
'\220\001P\230<\322O\260\326\226?}(\341\177r'
|
||||||
|
@ -25,16 +25,22 @@ to obtain the digest of the string \code{'abc'}, use \ldots
|
||||||
More condensed:
|
More condensed:
|
||||||
|
|
||||||
\bcode\begin{verbatim}
|
\bcode\begin{verbatim}
|
||||||
>>> md5('abc').digest()
|
>>> md5.new('abc').digest()
|
||||||
'\220\001P\230<\322O\260\326\226?}(\341\177r'
|
'\220\001P\230<\322O\260\326\226?}(\341\177r'
|
||||||
\end{verbatim}\ecode
|
\end{verbatim}\ecode
|
||||||
|
|
||||||
\renewcommand{\indexsubitem}{(in module md5)}
|
\renewcommand{\indexsubitem}{(in module md5)}
|
||||||
\begin{funcdesc}{md5}{\optional{arg}}
|
|
||||||
|
\begin{funcdesc}{new}{\optional{arg}}
|
||||||
Create a new md5-object. If \var{arg} is present, an initial
|
Create a new md5-object. If \var{arg} is present, an initial
|
||||||
\code{update} method is called with \var{arg} as argument.
|
\code{update} method is called with \var{arg} as argument.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
\begin{funcdesc}{md5}{\optional{arg}}
|
||||||
|
For backward compatibility reasons, this is an alternative name for the
|
||||||
|
\code{new} function.
|
||||||
|
\end{funcdesc}
|
||||||
|
|
||||||
An md5-object has the following methods:
|
An md5-object has the following methods:
|
||||||
|
|
||||||
\renewcommand{\indexsubitem}{(md5 method)}
|
\renewcommand{\indexsubitem}{(md5 method)}
|
||||||
|
|
|
@ -50,6 +50,12 @@ Change the current working directory to \var{path}.
|
||||||
Change the mode of \var{path} to the numeric \var{mode}.
|
Change the mode of \var{path} to the numeric \var{mode}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
\begin{funcdesc}{chown}{path\, uid, gid}
|
||||||
|
Change the owner and group id of \var{path} to the numeric \var{uid}
|
||||||
|
and \var{gid}.
|
||||||
|
(Not on MS-DOS.)
|
||||||
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{close}{fd}
|
\begin{funcdesc}{close}{fd}
|
||||||
Close file descriptor \var{fd}.
|
Close file descriptor \var{fd}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
|
@ -38,7 +38,7 @@ The posixfile module defines the following functions:
|
||||||
builtin function.
|
builtin function.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{openfile}{fileobject}
|
\begin{funcdesc}{fileopen}{fileobject}
|
||||||
Create a new posixfile object with the given standard file object.
|
Create a new posixfile object with the given standard file object.
|
||||||
The resulting object has the same filename and mode as the original
|
The resulting object has the same filename and mode as the original
|
||||||
file object.
|
file object.
|
||||||
|
|
|
@ -79,7 +79,16 @@ is an IP address itself it is returned unchanged.
|
||||||
Return a string containing the hostname of the machine where
|
Return a string containing the hostname of the machine where
|
||||||
the Python interpreter is currently executing. If you want to know the
|
the Python interpreter is currently executing. If you want to know the
|
||||||
current machine's IP address, use
|
current machine's IP address, use
|
||||||
\code{socket.gethostbyname( socket.gethostname() )} instead.
|
\code{socket.gethostbyname(socket.gethostname())} instead.
|
||||||
|
\end{funcdesc}
|
||||||
|
|
||||||
|
\begin{funcdesc}{gethostbyaddr}{ip_address}
|
||||||
|
Return a triple \code{(hostname, aliaslist, ipaddrlist)} where
|
||||||
|
\code{hostname} is the primary host name responding to the given
|
||||||
|
\var{ip_address}, \code{aliaslist} is a (possibly empty) list of
|
||||||
|
alternative host names for the same address, and \code{ipaddrlist} is
|
||||||
|
a list of IP addresses for the same interface on the same
|
||||||
|
host (most likely containing only a single address).
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{getservbyname}{servicename\, protocolname}
|
\begin{funcdesc}{getservbyname}{servicename\, protocolname}
|
||||||
|
|
|
@ -580,7 +580,14 @@ Files have the following methods:
|
||||||
|
|
||||||
\begin{funcdesc}{readline}{}
|
\begin{funcdesc}{readline}{}
|
||||||
Read one entire line from the file. A trailing newline character is
|
Read one entire line from the file. A trailing newline character is
|
||||||
kept in the string (but may be absent when a file ends with an
|
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
|
||||||
|
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!).}
|
||||||
|
(but may be absent when a file ends with an
|
||||||
incomplete line). An empty string is returned when \EOF{} is hit
|
incomplete line). An empty string is returned when \EOF{} is hit
|
||||||
immediately. Note: unlike \code{stdio}'s \code{fgets()}, the returned
|
immediately. Note: unlike \code{stdio}'s \code{fgets()}, the returned
|
||||||
string contains null characters (\code{'\e 0'}) if they occurred in the
|
string contains null characters (\code{'\e 0'}) if they occurred in the
|
||||||
|
|
|
@ -44,6 +44,7 @@ They are:
|
||||||
\code{floor(\varvars{x})},
|
\code{floor(\varvars{x})},
|
||||||
\code{fmod(\varvars{x\, y})},
|
\code{fmod(\varvars{x\, y})},
|
||||||
\code{frexp(\varvars{x})},
|
\code{frexp(\varvars{x})},
|
||||||
|
\code{hypot(\varvars{x\, y})},
|
||||||
\code{ldexp(\varvars{x\, y})},
|
\code{ldexp(\varvars{x\, y})},
|
||||||
\code{log(\varvars{x})},
|
\code{log(\varvars{x})},
|
||||||
\code{log10(\varvars{x})},
|
\code{log10(\varvars{x})},
|
||||||
|
@ -61,6 +62,9 @@ pattern than their C equivalents: they take a single argument and
|
||||||
return a pair of values, rather than returning their second return
|
return a pair of values, rather than returning their second return
|
||||||
value through an `output parameter' (there is no such thing in Python).
|
value through an `output parameter' (there is no such thing in Python).
|
||||||
|
|
||||||
|
The \code{hypot} function, which is not standard C, is not available
|
||||||
|
on all platforms.
|
||||||
|
|
||||||
The module also defines two mathematical constants:
|
The module also defines two mathematical constants:
|
||||||
\iftexi
|
\iftexi
|
||||||
\begin{datadesc}{pi}
|
\begin{datadesc}{pi}
|
||||||
|
|
|
@ -15,8 +15,8 @@ example will be helpful:
|
||||||
to obtain the digest of the string \code{'abc'}, use \ldots
|
to obtain the digest of the string \code{'abc'}, use \ldots
|
||||||
|
|
||||||
\bcode\begin{verbatim}
|
\bcode\begin{verbatim}
|
||||||
>>> from md5 import md5
|
>>> import md5
|
||||||
>>> m = md5()
|
>>> m = md5.new()
|
||||||
>>> m.update('abc')
|
>>> m.update('abc')
|
||||||
>>> m.digest()
|
>>> m.digest()
|
||||||
'\220\001P\230<\322O\260\326\226?}(\341\177r'
|
'\220\001P\230<\322O\260\326\226?}(\341\177r'
|
||||||
|
@ -25,16 +25,22 @@ to obtain the digest of the string \code{'abc'}, use \ldots
|
||||||
More condensed:
|
More condensed:
|
||||||
|
|
||||||
\bcode\begin{verbatim}
|
\bcode\begin{verbatim}
|
||||||
>>> md5('abc').digest()
|
>>> md5.new('abc').digest()
|
||||||
'\220\001P\230<\322O\260\326\226?}(\341\177r'
|
'\220\001P\230<\322O\260\326\226?}(\341\177r'
|
||||||
\end{verbatim}\ecode
|
\end{verbatim}\ecode
|
||||||
|
|
||||||
\renewcommand{\indexsubitem}{(in module md5)}
|
\renewcommand{\indexsubitem}{(in module md5)}
|
||||||
\begin{funcdesc}{md5}{\optional{arg}}
|
|
||||||
|
\begin{funcdesc}{new}{\optional{arg}}
|
||||||
Create a new md5-object. If \var{arg} is present, an initial
|
Create a new md5-object. If \var{arg} is present, an initial
|
||||||
\code{update} method is called with \var{arg} as argument.
|
\code{update} method is called with \var{arg} as argument.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
\begin{funcdesc}{md5}{\optional{arg}}
|
||||||
|
For backward compatibility reasons, this is an alternative name for the
|
||||||
|
\code{new} function.
|
||||||
|
\end{funcdesc}
|
||||||
|
|
||||||
An md5-object has the following methods:
|
An md5-object has the following methods:
|
||||||
|
|
||||||
\renewcommand{\indexsubitem}{(md5 method)}
|
\renewcommand{\indexsubitem}{(md5 method)}
|
||||||
|
|
|
@ -50,6 +50,12 @@ Change the current working directory to \var{path}.
|
||||||
Change the mode of \var{path} to the numeric \var{mode}.
|
Change the mode of \var{path} to the numeric \var{mode}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
\begin{funcdesc}{chown}{path\, uid, gid}
|
||||||
|
Change the owner and group id of \var{path} to the numeric \var{uid}
|
||||||
|
and \var{gid}.
|
||||||
|
(Not on MS-DOS.)
|
||||||
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{close}{fd}
|
\begin{funcdesc}{close}{fd}
|
||||||
Close file descriptor \var{fd}.
|
Close file descriptor \var{fd}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
|
@ -38,7 +38,7 @@ The posixfile module defines the following functions:
|
||||||
builtin function.
|
builtin function.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{openfile}{fileobject}
|
\begin{funcdesc}{fileopen}{fileobject}
|
||||||
Create a new posixfile object with the given standard file object.
|
Create a new posixfile object with the given standard file object.
|
||||||
The resulting object has the same filename and mode as the original
|
The resulting object has the same filename and mode as the original
|
||||||
file object.
|
file object.
|
||||||
|
|
|
@ -79,7 +79,16 @@ is an IP address itself it is returned unchanged.
|
||||||
Return a string containing the hostname of the machine where
|
Return a string containing the hostname of the machine where
|
||||||
the Python interpreter is currently executing. If you want to know the
|
the Python interpreter is currently executing. If you want to know the
|
||||||
current machine's IP address, use
|
current machine's IP address, use
|
||||||
\code{socket.gethostbyname( socket.gethostname() )} instead.
|
\code{socket.gethostbyname(socket.gethostname())} instead.
|
||||||
|
\end{funcdesc}
|
||||||
|
|
||||||
|
\begin{funcdesc}{gethostbyaddr}{ip_address}
|
||||||
|
Return a triple \code{(hostname, aliaslist, ipaddrlist)} where
|
||||||
|
\code{hostname} is the primary host name responding to the given
|
||||||
|
\var{ip_address}, \code{aliaslist} is a (possibly empty) list of
|
||||||
|
alternative host names for the same address, and \code{ipaddrlist} is
|
||||||
|
a list of IP addresses for the same interface on the same
|
||||||
|
host (most likely containing only a single address).
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{getservbyname}{servicename\, protocolname}
|
\begin{funcdesc}{getservbyname}{servicename\, protocolname}
|
||||||
|
|
|
@ -580,7 +580,14 @@ Files have the following methods:
|
||||||
|
|
||||||
\begin{funcdesc}{readline}{}
|
\begin{funcdesc}{readline}{}
|
||||||
Read one entire line from the file. A trailing newline character is
|
Read one entire line from the file. A trailing newline character is
|
||||||
kept in the string (but may be absent when a file ends with an
|
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
|
||||||
|
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!).}
|
||||||
|
(but may be absent when a file ends with an
|
||||||
incomplete line). An empty string is returned when \EOF{} is hit
|
incomplete line). An empty string is returned when \EOF{} is hit
|
||||||
immediately. Note: unlike \code{stdio}'s \code{fgets()}, the returned
|
immediately. Note: unlike \code{stdio}'s \code{fgets()}, the returned
|
||||||
string contains null characters (\code{'\e 0'}) if they occurred in the
|
string contains null characters (\code{'\e 0'}) if they occurred in the
|
||||||
|
|
|
@ -470,7 +470,7 @@ A file object represents an open file. (It is a wrapper around a C
|
||||||
\verb@open()@ built-in function, and also by \verb@posix.popen()@ and
|
\verb@open()@ built-in function, and also by \verb@posix.popen()@ and
|
||||||
the \verb@makefile@ method of socket objects. \verb@sys.stdin@,
|
the \verb@makefile@ method of socket objects. \verb@sys.stdin@,
|
||||||
\verb@sys.stdout@ and \verb@sys.stderr@ are file objects corresponding
|
\verb@sys.stdout@ and \verb@sys.stderr@ are file objects corresponding
|
||||||
the the interpreter's standard input, output and error streams.
|
to the interpreter's standard input, output and error streams.
|
||||||
See the Python Library Reference for methods of file objects and other
|
See the Python Library Reference for methods of file objects and other
|
||||||
details.
|
details.
|
||||||
\obindex{file}
|
\obindex{file}
|
||||||
|
@ -498,7 +498,7 @@ but they are mentioned here for completeness.
|
||||||
Code objects represent executable code. The difference between a code
|
Code objects represent executable code. The difference between a code
|
||||||
object and a function object is that the function object contains an
|
object and a function object is that the function object contains an
|
||||||
explicit reference to the function's context (the module in which it
|
explicit reference to the function's context (the module in which it
|
||||||
was defined) which a code object contains no context. There is no way
|
was defined) while a code object contains no context. There is no way
|
||||||
to execute a bare code object.
|
to execute a bare code object.
|
||||||
\obindex{code}
|
\obindex{code}
|
||||||
|
|
||||||
|
@ -622,8 +622,12 @@ former decrements the reference count for \code{x} by one, but
|
||||||
\code{x,__del__} is only called when its reference count reaches zero.
|
\code{x,__del__} is only called when its reference count reaches zero.
|
||||||
|
|
||||||
\item[\tt __repr__(self)]
|
\item[\tt __repr__(self)]
|
||||||
Called by the \verb@repr()@ built-in function and by conversions
|
Called by the \verb@repr()@ built-in function and by string conversions
|
||||||
(reverse quotes) to compute the string representation of an object.
|
(reverse or backward quotes) to compute the string representation of an object.
|
||||||
|
\indexii{string}{conversion}
|
||||||
|
\indexii{reverse}{quotes}
|
||||||
|
\indexii{backward}{quotes}
|
||||||
|
\index{back-quotes}
|
||||||
|
|
||||||
\item[\tt __str__(self)]
|
\item[\tt __str__(self)]
|
||||||
Called by the \verb@str()@ built-in function and by the \verb@print@
|
Called by the \verb@str()@ built-in function and by the \verb@print@
|
||||||
|
|
|
@ -72,9 +72,9 @@ When a global name is not found in the global name space, it is
|
||||||
searched in the list of ``built-in'' names (which is actually the
|
searched in the list of ``built-in'' names (which is actually the
|
||||||
global name space of the module \verb@__builtin__@). When a name is not
|
global name space of the module \verb@__builtin__@). When a name is not
|
||||||
found at all, the \verb@NameError@ exception is raised.%
|
found at all, the \verb@NameError@ exception is raised.%
|
||||||
\footnote{If the code block contains \verb@exec@ statements or the
|
\footnote{If the code block contains {\tt exec} statements or the
|
||||||
construct \verb@from ... import *@, the semantics of names not
|
construct {\tt from \ldots import *}, the semantics of names not
|
||||||
explicitly mentioned in a \verb@global@ statement change subtly: name
|
explicitly mentioned in a {\tt global} statement change subtly: name
|
||||||
lookup first searches the local name space, then the global one, then
|
lookup first searches the local name space, then the global one, then
|
||||||
the built-in one.}
|
the built-in one.}
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,9 @@ value prevails.
|
||||||
|
|
||||||
\subsection{String conversions}
|
\subsection{String conversions}
|
||||||
\indexii{string}{conversion}
|
\indexii{string}{conversion}
|
||||||
|
\indexii{reverse}{quotes}
|
||||||
|
\indexii{backward}{quotes}
|
||||||
|
\index{back-quotes}
|
||||||
|
|
||||||
A string conversion is a condition list enclosed in reverse (or
|
A string conversion is a condition list enclosed in reverse (or
|
||||||
backward) quotes:
|
backward) quotes:
|
||||||
|
@ -214,6 +217,13 @@ dictionaries that contain a reference to themselves, directly or
|
||||||
indirectly.)
|
indirectly.)
|
||||||
\obindex{recursive}
|
\obindex{recursive}
|
||||||
|
|
||||||
|
The built-in function \verb@repr()@ performs exactly the same
|
||||||
|
conversion in its argument as enclosing it it reverse quotes does.
|
||||||
|
The built-in function \verb@str()@ performs a similar but more
|
||||||
|
user-friendly conversion.
|
||||||
|
\bifuncindex{repr}
|
||||||
|
\bifuncindex{str}
|
||||||
|
|
||||||
\section{Primaries} \label{primaries}
|
\section{Primaries} \label{primaries}
|
||||||
\index{primary}
|
\index{primary}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ sequence cannot add new items to a list).
|
||||||
|
|
||||||
If the primary is a mapping (dictionary) object, the subscript must
|
If the primary is a mapping (dictionary) object, the subscript must
|
||||||
have a type compatible with the mapping's key type, and the mapping is
|
have a type compatible with the mapping's key type, and the mapping is
|
||||||
then asked to to create a key/datum pair which maps the subscript to
|
then asked to create a key/datum pair which maps the subscript to
|
||||||
the assigned object. This can either replace an existing key/value
|
the assigned object. This can either replace an existing key/value
|
||||||
pair with the same key value, or insert a new key/value pair (if no
|
pair with the same key value, or insert a new key/value pair (if no
|
||||||
key with the same value existed).
|
key with the same value existed).
|
||||||
|
@ -369,7 +369,7 @@ continue_stmt: "continue"
|
||||||
\verb@continue@ may only occur syntactically nested in a \verb@for@ or
|
\verb@continue@ may only occur syntactically nested in a \verb@for@ or
|
||||||
\verb@while@ loop, but not nested in a function or class definition or
|
\verb@while@ loop, but not nested in a function or class definition or
|
||||||
\verb@try@ statement within that loop.\footnote{Except that it may
|
\verb@try@ statement within that loop.\footnote{Except that it may
|
||||||
currently occur within an \verb@except@ clause.}
|
currently occur within an {\tt except} clause.}
|
||||||
\stindex{for}
|
\stindex{for}
|
||||||
\stindex{while}
|
\stindex{while}
|
||||||
\indexii{loop}{statement}
|
\indexii{loop}{statement}
|
||||||
|
|
|
@ -299,7 +299,7 @@ default value is substituted. If a parameter has a default value, all
|
||||||
following parameters must also have a default value --- this is a
|
following parameters must also have a default value --- this is a
|
||||||
syntactic restriction that is not expressed by the grammar.%
|
syntactic restriction that is not expressed by the grammar.%
|
||||||
\footnote{Currently this is not checked; instead,
|
\footnote{Currently this is not checked; instead,
|
||||||
\verb@def f(a=1,b)@ is interpreted as \verb@def f(a=1,b=None)@.}
|
{\tt def f(a=1,b)} is interpreted as {\tt def f(a=1,b=None)}.}
|
||||||
\indexiii{default}{parameter}{value}
|
\indexiii{default}{parameter}{value}
|
||||||
|
|
||||||
Function call semantics are described in section \ref{calls}. When a
|
Function call semantics are described in section \ref{calls}. When a
|
||||||
|
|
12
Doc/ref3.tex
12
Doc/ref3.tex
|
@ -470,7 +470,7 @@ A file object represents an open file. (It is a wrapper around a C
|
||||||
\verb@open()@ built-in function, and also by \verb@posix.popen()@ and
|
\verb@open()@ built-in function, and also by \verb@posix.popen()@ and
|
||||||
the \verb@makefile@ method of socket objects. \verb@sys.stdin@,
|
the \verb@makefile@ method of socket objects. \verb@sys.stdin@,
|
||||||
\verb@sys.stdout@ and \verb@sys.stderr@ are file objects corresponding
|
\verb@sys.stdout@ and \verb@sys.stderr@ are file objects corresponding
|
||||||
the the interpreter's standard input, output and error streams.
|
to the interpreter's standard input, output and error streams.
|
||||||
See the Python Library Reference for methods of file objects and other
|
See the Python Library Reference for methods of file objects and other
|
||||||
details.
|
details.
|
||||||
\obindex{file}
|
\obindex{file}
|
||||||
|
@ -498,7 +498,7 @@ but they are mentioned here for completeness.
|
||||||
Code objects represent executable code. The difference between a code
|
Code objects represent executable code. The difference between a code
|
||||||
object and a function object is that the function object contains an
|
object and a function object is that the function object contains an
|
||||||
explicit reference to the function's context (the module in which it
|
explicit reference to the function's context (the module in which it
|
||||||
was defined) which a code object contains no context. There is no way
|
was defined) while a code object contains no context. There is no way
|
||||||
to execute a bare code object.
|
to execute a bare code object.
|
||||||
\obindex{code}
|
\obindex{code}
|
||||||
|
|
||||||
|
@ -622,8 +622,12 @@ former decrements the reference count for \code{x} by one, but
|
||||||
\code{x,__del__} is only called when its reference count reaches zero.
|
\code{x,__del__} is only called when its reference count reaches zero.
|
||||||
|
|
||||||
\item[\tt __repr__(self)]
|
\item[\tt __repr__(self)]
|
||||||
Called by the \verb@repr()@ built-in function and by conversions
|
Called by the \verb@repr()@ built-in function and by string conversions
|
||||||
(reverse quotes) to compute the string representation of an object.
|
(reverse or backward quotes) to compute the string representation of an object.
|
||||||
|
\indexii{string}{conversion}
|
||||||
|
\indexii{reverse}{quotes}
|
||||||
|
\indexii{backward}{quotes}
|
||||||
|
\index{back-quotes}
|
||||||
|
|
||||||
\item[\tt __str__(self)]
|
\item[\tt __str__(self)]
|
||||||
Called by the \verb@str()@ built-in function and by the \verb@print@
|
Called by the \verb@str()@ built-in function and by the \verb@print@
|
||||||
|
|
|
@ -72,9 +72,9 @@ When a global name is not found in the global name space, it is
|
||||||
searched in the list of ``built-in'' names (which is actually the
|
searched in the list of ``built-in'' names (which is actually the
|
||||||
global name space of the module \verb@__builtin__@). When a name is not
|
global name space of the module \verb@__builtin__@). When a name is not
|
||||||
found at all, the \verb@NameError@ exception is raised.%
|
found at all, the \verb@NameError@ exception is raised.%
|
||||||
\footnote{If the code block contains \verb@exec@ statements or the
|
\footnote{If the code block contains {\tt exec} statements or the
|
||||||
construct \verb@from ... import *@, the semantics of names not
|
construct {\tt from \ldots import *}, the semantics of names not
|
||||||
explicitly mentioned in a \verb@global@ statement change subtly: name
|
explicitly mentioned in a {\tt global} statement change subtly: name
|
||||||
lookup first searches the local name space, then the global one, then
|
lookup first searches the local name space, then the global one, then
|
||||||
the built-in one.}
|
the built-in one.}
|
||||||
|
|
||||||
|
|
10
Doc/ref5.tex
10
Doc/ref5.tex
|
@ -187,6 +187,9 @@ value prevails.
|
||||||
|
|
||||||
\subsection{String conversions}
|
\subsection{String conversions}
|
||||||
\indexii{string}{conversion}
|
\indexii{string}{conversion}
|
||||||
|
\indexii{reverse}{quotes}
|
||||||
|
\indexii{backward}{quotes}
|
||||||
|
\index{back-quotes}
|
||||||
|
|
||||||
A string conversion is a condition list enclosed in reverse (or
|
A string conversion is a condition list enclosed in reverse (or
|
||||||
backward) quotes:
|
backward) quotes:
|
||||||
|
@ -214,6 +217,13 @@ dictionaries that contain a reference to themselves, directly or
|
||||||
indirectly.)
|
indirectly.)
|
||||||
\obindex{recursive}
|
\obindex{recursive}
|
||||||
|
|
||||||
|
The built-in function \verb@repr()@ performs exactly the same
|
||||||
|
conversion in its argument as enclosing it it reverse quotes does.
|
||||||
|
The built-in function \verb@str()@ performs a similar but more
|
||||||
|
user-friendly conversion.
|
||||||
|
\bifuncindex{repr}
|
||||||
|
\bifuncindex{str}
|
||||||
|
|
||||||
\section{Primaries} \label{primaries}
|
\section{Primaries} \label{primaries}
|
||||||
\index{primary}
|
\index{primary}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ sequence cannot add new items to a list).
|
||||||
|
|
||||||
If the primary is a mapping (dictionary) object, the subscript must
|
If the primary is a mapping (dictionary) object, the subscript must
|
||||||
have a type compatible with the mapping's key type, and the mapping is
|
have a type compatible with the mapping's key type, and the mapping is
|
||||||
then asked to to create a key/datum pair which maps the subscript to
|
then asked to create a key/datum pair which maps the subscript to
|
||||||
the assigned object. This can either replace an existing key/value
|
the assigned object. This can either replace an existing key/value
|
||||||
pair with the same key value, or insert a new key/value pair (if no
|
pair with the same key value, or insert a new key/value pair (if no
|
||||||
key with the same value existed).
|
key with the same value existed).
|
||||||
|
@ -369,7 +369,7 @@ continue_stmt: "continue"
|
||||||
\verb@continue@ may only occur syntactically nested in a \verb@for@ or
|
\verb@continue@ may only occur syntactically nested in a \verb@for@ or
|
||||||
\verb@while@ loop, but not nested in a function or class definition or
|
\verb@while@ loop, but not nested in a function or class definition or
|
||||||
\verb@try@ statement within that loop.\footnote{Except that it may
|
\verb@try@ statement within that loop.\footnote{Except that it may
|
||||||
currently occur within an \verb@except@ clause.}
|
currently occur within an {\tt except} clause.}
|
||||||
\stindex{for}
|
\stindex{for}
|
||||||
\stindex{while}
|
\stindex{while}
|
||||||
\indexii{loop}{statement}
|
\indexii{loop}{statement}
|
||||||
|
|
|
@ -299,7 +299,7 @@ default value is substituted. If a parameter has a default value, all
|
||||||
following parameters must also have a default value --- this is a
|
following parameters must also have a default value --- this is a
|
||||||
syntactic restriction that is not expressed by the grammar.%
|
syntactic restriction that is not expressed by the grammar.%
|
||||||
\footnote{Currently this is not checked; instead,
|
\footnote{Currently this is not checked; instead,
|
||||||
\verb@def f(a=1,b)@ is interpreted as \verb@def f(a=1,b=None)@.}
|
{\tt def f(a=1,b)} is interpreted as {\tt def f(a=1,b=None)}.}
|
||||||
\indexiii{default}{parameter}{value}
|
\indexiii{default}{parameter}{value}
|
||||||
|
|
||||||
Function call semantics are described in section \ref{calls}. When a
|
Function call semantics are described in section \ref{calls}. When a
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
||||||
Amsterdam, The Netherlands.
|
The Netherlands.
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
Loading…
Reference in New Issue