Python Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 93)
93.
In Python, what is the purpose of the @classmethod decorator?
To create a new instance of the class
To define a method that can be accessed like an attribute
To access class attributes directly
To define a method that takes the class as its first argument
Answer: Option
Explanation:
The @classmethod decorator is used to define a method that takes the class as its first argument, conventionally named cls.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.