diff options
author | Georg Brandl <georg@python.org> | 2009-10-22 15:27:24 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-10-22 15:27:24 (GMT) |
commit | 030d65811fad6cc6a2bf5d51860e6defa206df0a (patch) | |
tree | bd7388bccbb0c61e7208efb89b6537fbc4942a22 /Doc/reference | |
parent | c5026f8a7b0870d7ada0a4cc009ed13f38446102 (diff) | |
download | cpython-030d65811fad6cc6a2bf5d51860e6defa206df0a.zip cpython-030d65811fad6cc6a2bf5d51860e6defa206df0a.tar.gz cpython-030d65811fad6cc6a2bf5d51860e6defa206df0a.tar.bz2 |
Reorder __slots__ fine print and add a clarification.
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/datamodel.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 3f9b181..5189f1f 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1675,15 +1675,15 @@ Notes on using *__slots__* *__slots__*; otherwise, the class attribute would overwrite the descriptor assignment. +* The action of a *__slots__* declaration is limited to the class where it is + defined. As a result, subclasses will have a *__dict__* unless they also define + *__slots__* (which must only contain names of any *additional* slots). + * If a class defines a slot also defined in a base class, the instance variable defined by the base class slot is inaccessible (except by retrieving its descriptor directly from the base class). This renders the meaning of the program undefined. In the future, a check may be added to prevent this. -* The action of a *__slots__* declaration is limited to the class where it is - defined. As a result, subclasses will have a *__dict__* unless they also define - *__slots__*. - * Nonempty *__slots__* does not work for classes derived from "variable-length" built-in types such as :class:`long`, :class:`str` and :class:`tuple`. |