← Quiz: Magic Methods and Properties: all 10 questions
Quiz: Magic Methods and Properties · Question 8 of 10
What is the first parameter of a @classmethod?
What is the first parameter of a @classmethod?
- A.self, the object
- B.cls, the class
- C.There is none
- D.The parent class
Answer & explanation
Correct answer: cls, the class
classmethods receive the class, which is why they suit alternative constructors.
Can you get the rest right without peeking?
Take the timed Quiz: Magic Methods and Properties quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →