homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Clarify __slots__ behaviour when inheriting
Type: enhancement Stage:
Components: Documentation Versions: Python 2.4, Python 2.3, Python 2.2.3, Python 2.7, Python 2.6, Python 2.2.2, Python 2.5, Python 2.2.1, Python 2.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, strangefeatures
Priority: normal Keywords:

Created on 2008年07月09日 07:22 by strangefeatures, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Messages (2)
msg69460 - (view) Author: Andy (strangefeatures) Date: 2008年07月09日 07:22
Suggest clarification on behaviour of the __slots__ attribute when
inheriting from classes that don't have __slots__ defined. Obviously the
superclass automatically creates __dict__, and it seems the subclass
inherits this. I presume this is expected behaviour, but I think it
would be worth clarifying in the 'Notes on using __slots__' section -
perhaps add something like:
"If you define __slots__ on a subclass when its superclass doesn't have
__slots__ defined, the superclass will automatically create a __dict__
instance which will be inherited by the subclass (as will other instance
attributes). Defining __slots__ on the subclass doesn't block this
inheritance."
msg70020 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008年07月19日 13:09
Added a note in r65136, thanks.
History
Date User Action Args
2022年04月11日 14:56:36adminsetgithub: 47573
2008年07月19日 13:09:52georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg70020
2008年07月09日 07:22:58strangefeaturescreate

AltStyle によって変換されたページ (->オリジナル) /