Vidyalelo
Python · Q13

Decorators in Depth

Programming · Python · question 13

Q13

What is the role of the @staticmethod decorator in Python?

A.
To define static variables
B.
To make a method callable without an instance
Answer
C.
To add static typing to variables
D.
To prevent method overriding

Answer: Option B

Solution

Answer: Option B
Solution:
The @staticmethod decorator allows a method to be called without creating an instance of the class.