diff options
author | Georg Brandl <georg@python.org> | 2008-07-19 13:09:42 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-07-19 13:09:42 (GMT) |
commit | 3de1e69dc7adc3eff84e0c1b8b22b4abdc58d268 (patch) | |
tree | 8de4d10e86dbb238d495c2655a72529d8a0a67bc /Doc/reference | |
parent | 59ec315b0485cf383b7c8f65903d0194c562a10c (diff) | |
download | cpython-3de1e69dc7adc3eff84e0c1b8b22b4abdc58d268.zip cpython-3de1e69dc7adc3eff84e0c1b8b22b4abdc58d268.tar.gz cpython-3de1e69dc7adc3eff84e0c1b8b22b4abdc58d268.tar.bz2 |
#3323: mention that if inheriting from a class without __slots__,
the subclass will have a __dict__ available too.
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/datamodel.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index bf9287c..9e28fe9 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1600,6 +1600,10 @@ variable. Space is saved because *__dict__* is not created for each instance. Notes on using *__slots__* +* When inheriting from a class without *__slots__*, the *__dict__* attribute of + that class will always be accessible, so a *__slots__* definition in the + subclass is meaningless. + * Without a *__dict__* variable, instances cannot be assigned new variables not listed in the *__slots__* definition. Attempts to assign to an unlisted variable name raises :exc:`AttributeError`. If dynamic assignment of new |