]> granicus.if.org Git - python/commitdiff
#3323: mention that if inheriting from a class without __slots__,
authorGeorg Brandl <georg@python.org>
Sat, 19 Jul 2008 13:09:42 +0000 (13:09 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 19 Jul 2008 13:09:42 +0000 (13:09 +0000)
the subclass will have a __dict__ available too.

Doc/reference/datamodel.rst

index bf9287c6c15e0fa5c6caff327d8a09d5558d6fe1..9e28fe9697f4f9d64a566c1b83f83098d80e45e9 100644 (file)
@@ -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