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

A subclass declares `__slots__` but its base class does not. What happens to instance attribute storage?

class Base: pass class Child(Base): __slots__ = ('x',) c = Child() c.x = 1 c.y = 2 # not in __slots__ print(hasattr(c, '__dict__'))