Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardPython__slots__ layoutSingle-choice MCQ

Both a base class and its subclass list the SAME name in __slots__. After b = B(); b.x = 5, what is the state of the storage, and what happens via the base's slot descriptor?

class A: __slots__ = ('x',) class B(A): __slots__ = ('x',) b = B(); b.x = 5 print(b.x) print(A.x.__get__(b)) # AttributeError