diff options
author | Guido van Rossum <guido@python.org> | 1993-05-24 14:19:37 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-05-24 14:19:37 (GMT) |
commit | 23301a9467024eb70b654924c3f0a54d76702e47 (patch) | |
tree | 5db8a61d44362828c147c19a369ca0a25eaa7a43 /Doc | |
parent | d316607732aa70361d5793f6b301b70fab7ca367 (diff) | |
download | cpython-23301a9467024eb70b654924c3f0a54d76702e47.zip cpython-23301a9467024eb70b654924c3f0a54d76702e47.tar.gz cpython-23301a9467024eb70b654924c3f0a54d76702e47.tar.bz2 |
* lib1.tex: documented dict.items() and dict.values()
* ref3.tex: documented new __init__ and __del__ special methods of
class instances.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/partparse.py | 2 | ||||
-rw-r--r-- | Doc/ref/ref3.tex | 18 | ||||
-rw-r--r-- | Doc/ref3.tex | 18 | ||||
-rw-r--r-- | Doc/tools/partparse.py | 2 |
4 files changed, 38 insertions, 2 deletions
diff --git a/Doc/partparse.py b/Doc/partparse.py index 83b58bd..1f8e952 100644 --- a/Doc/partparse.py +++ b/Doc/partparse.py @@ -1001,7 +1001,7 @@ def next_command_p(length, buf, pp, i, cmdname): # things that are special to LaTeX, but not to texi.. onlylatexspecial = '_~^$#&%' -class Struct(): pass +class Struct: pass hist = Struct() out = Struct() diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex index 2d3b1e8..df62486 100644 --- a/Doc/ref/ref3.tex +++ b/Doc/ref/ref3.tex @@ -592,6 +592,24 @@ interpretations are used in this case. \begin{description} +\item[\tt __init__(self, args...)] +Called when the instance is created. The arguments are those passed +to the class constructor expression. If a base class has an +\code{__init__} method the derived class's \code{__init__} method must +explicitly call it to ensure proper initialization of the base class +part of the instance. + +\item[\tt __del__(self)] +Called when the instance is about to be destroyed. If a base class +has an \code{__del__} method the derived class's \code{__del__} method +must explicitly call it to ensure proper deletion of the base class +part of the instance. Note that it is possible for the \code{__del__} +method to postpone destruction of the instance by creating a new +reference to it. It may then be called at a later time when this new +reference is deleted. Also note that it is not guaranteed that +\code{__del__} methods are called for objects that still exist when +the interpreter exits. + \item[\tt __repr__(self)] Called by the \verb\print\ statement and conversions (reverse quotes) to compute the string representation of an object. diff --git a/Doc/ref3.tex b/Doc/ref3.tex index 2d3b1e8..df62486 100644 --- a/Doc/ref3.tex +++ b/Doc/ref3.tex @@ -592,6 +592,24 @@ interpretations are used in this case. \begin{description} +\item[\tt __init__(self, args...)] +Called when the instance is created. The arguments are those passed +to the class constructor expression. If a base class has an +\code{__init__} method the derived class's \code{__init__} method must +explicitly call it to ensure proper initialization of the base class +part of the instance. + +\item[\tt __del__(self)] +Called when the instance is about to be destroyed. If a base class +has an \code{__del__} method the derived class's \code{__del__} method +must explicitly call it to ensure proper deletion of the base class +part of the instance. Note that it is possible for the \code{__del__} +method to postpone destruction of the instance by creating a new +reference to it. It may then be called at a later time when this new +reference is deleted. Also note that it is not guaranteed that +\code{__del__} methods are called for objects that still exist when +the interpreter exits. + \item[\tt __repr__(self)] Called by the \verb\print\ statement and conversions (reverse quotes) to compute the string representation of an object. diff --git a/Doc/tools/partparse.py b/Doc/tools/partparse.py index 83b58bd..1f8e952 100644 --- a/Doc/tools/partparse.py +++ b/Doc/tools/partparse.py @@ -1001,7 +1001,7 @@ def next_command_p(length, buf, pp, i, cmdname): # things that are special to LaTeX, but not to texi.. onlylatexspecial = '_~^$#&%' -class Struct(): pass +class Struct: pass hist = Struct() out = Struct() |