The _______ decorator in a class is used to turn a method into a class-specific method.
- @classmethod
- @classmethodmethod
- @instancemethod
- @staticmethod
The '@staticmethod' decorator in a class is used to turn a method into a class-specific method. Class-specific methods do not depend on instance-specific data and can be called on the class itself, without creating an instance.
Loading...
Related Quiz
- What is the primary purpose of the try and except blocks in Python?
- Consider a scenario where you need to check if neither 'a' nor 'b' are true in Python. Which of the following operators would you primarily use?
- Which built-in function can be used to create a set in Python?
- When defining a custom exception, it should typically be derived from the built-in ____ class.
- You are assigned to optimize a Python application. Which tool would you use to profile the Python code and find the bottlenecks?