diff options
author | Fred Drake <fdrake@acm.org> | 2003-09-24 04:11:47 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2003-09-24 04:11:47 (GMT) |
commit | 2348afd3f898c5f4070717b5e45eb3a02e34ce3c (patch) | |
tree | 43fbaa1db4646b80aad8bd7ed9dd3c75cc5c25bd /Doc/ref | |
parent | 16434b5e25542da8a9023e5930c74faae6a18ad8 (diff) | |
download | cpython-2348afd3f898c5f4070717b5e45eb3a02e34ce3c.zip cpython-2348afd3f898c5f4070717b5e45eb3a02e34ce3c.tar.gz cpython-2348afd3f898c5f4070717b5e45eb3a02e34ce3c.tar.bz2 |
- update to reflect that base classes can be class types as well as
"classic" class objects
[partially fixes SF bug #453684]
- add note that new-style classes can use descriptors to implement
instance variables in different ways
Diffstat (limited to 'Doc/ref')
-rw-r--r-- | Doc/ref/ref7.tex | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/ref/ref7.tex b/Doc/ref/ref7.tex index 346dce0..4770dc9 100644 --- a/Doc/ref/ref7.tex +++ b/Doc/ref/ref7.tex @@ -419,7 +419,8 @@ A class definition defines a class object (see section~\ref{types}): A class definition is an executable statement. It first evaluates the inheritance list, if present. Each item in the inheritance list -should evaluate to a class object. The class's suite is then executed +should evaluate to a class object or class type which allows +subclassing. The class's suite is then executed in a new execution frame (see section~\ref{naming}), using a newly created local namespace and the original global namespace. (Usually, the suite contains only function definitions.) When the @@ -433,7 +434,7 @@ class object in the original local namespace. \indexii{name}{binding} \indexii{execution}{frame} -\strong{Programmer's note:} variables defined in the class definition +\strong{Programmer's note:} Variables defined in the class definition are class variables; they are shared by all instances. To define instance variables, they must be given a value in the \method{__init__()} method or in another method. Both class and @@ -441,3 +442,5 @@ instance variables are accessible through the notation ``\code{self.name}'', and an instance variable hides a class variable with the same name when accessed in this way. Class variables with immutable values can be used as defaults for instance variables. +For new-style classes, descriptors can be used to create instance +variables with different implementation details. |