Python · OOP: Classes & Inheritance

Why does self.x inside __getattribute__ (or self.x = v inside __setattr__) hang the program, and what's the correct fix?

Answer locked. Get the free KnowCard app to reveal it — plus spaced-repetition review so it actually sticks.

Get it on App StoreGet it on Google Play

This is one card from the KnowCard library — thousands more across SAP, Linux, Python and more. In the app you get the answer, AI explanations, and cards that come back right before you would forget them. Free to start on iOS, Android or the web.

More in OOP: Classes & Inheritance

In a class, what must the first parameter of every (instance) method be, and what is passed into it?
What happens when you run this? ``` class Account: def show(): print("hi") Account().show() ```
Where should a class's instance attributes be created, and with what syntax?
Is __init__ a constructor in the strict sense, and what does it return?
What does this print? ``` class C: def __init__(self): print("init") x = C() ```
How does Python clean up an instance at the end of its life — is there a guaranteed destructor?

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play