On 1/11/21 6:31 PM, Greg Ewing wrote:
Guido said the same thing. I did say "Slots", not "__slots__", though. You'll find that your class D supports attributes "a", "b", "c", and "d", and that's the inheritance I was referring to.On 12/01/21 2:21 pm, Larry Hastings wrote:Slots intelligently support inheritance, too.Are you sure about that? My experiments suggest that it has the same problem as __annotations__: Python 3.8.2 (default, Mar 23 2020, 11:36:18) [Clang 8.1.0 (clang-802.0.42)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> class C: ... __slots__ = ['a', 'b'] ... >>> class D(C): ... __slots__ = ['c', 'd'] ... >>> class E(D): ... pass ... >>> C.__slots__ ['a', 'b'] >>> D.__slots__ ['c', 'd'] >>> E.__slots__ ['c', 'd'] >>>
Cheers, //arry/
_______________________________________________ Python-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/SPW4PSRJPRFLPG6LRJ5ATCYWJFC5PHGC/ Code of Conduct: http://python.org/psf/codeofconduct/