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

By default, why can't you create a weakref to an instance of a class that declares non-empty __slots__, and how is that fixed?

import weakref class A: __slots__ = ('x',) weakref.ref(A())