In the process of evaluating the class operator, a name change occurs. In the case of Bar the __cache attribute __cache not defined as part of the class, but rather is added to the specific object after the fact.
(Actually, this may not be entirely correct. When evaluating the __new__ method, a __new__ may occur. I donβt know. But independently, your __cache added explicitly to one object, not added class code.)
source share