On 1/11/21 6:31 PM, Greg Ewing wrote:
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']
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. Cheers, //arry/