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.

Author pitrou
Recipients alexandre.vassalotti, docs@python, pierreglaser, pitrou, serhiy.storchaka
Date 2019-02-07.22:21:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1549578094.63.0.0378848598051.issue35933@roundup.psfhosted.org>
In-reply-to
Content
You can have both a dict and slots by subclassing:

>>> class A: 
...:     __slots__ = ('x',) 
...:                                                                                                                                                                   
>>> class B(A): pass                                                                                                                                                   
>>>                                                                                                                                                                    
>>> b = B()                                                                                                                                                            
>>> b.x = 5                                                                                                                                                            
>>> b.y = 6                                                                                                                                                            
>>> b.__dict__                                                                                                                                                         
{'y': 6}
>>> A.x                                                                                                                                                                
<member 'x' of 'A' objects>
>>> A.x.__get__(b)                                                                                                                                                     
5
History
Date User Action Args
2019-02-07 22:21:35pitrousetrecipients: + pitrou, alexandre.vassalotti, docs@python, serhiy.storchaka, pierreglaser
2019-02-07 22:21:34pitrousetmessageid: <1549578094.63.0.0378848598051.issue35933@roundup.psfhosted.org>
2019-02-07 22:21:34pitroulinkissue35933 messages
2019-02-07 22:21:34pitroucreate