The ____ decorator is used to convert a function into a static method.
- @classmethod
- @classmethod
- @staticmethod
- @staticmethod()
In Python, the @staticmethod decorator is used to define a static method within a class. Static methods are methods that belong to a class rather than an instance and can be called on the class itself. They don't have access to the instance's state.
Loading...
Related Quiz
- Which of the following set methods does not modify the set but returns a new set?
- When implementing a recursive algorithm, what is crucial to avoid infinite recursion?
- The _______ file can control which modules are imported when 'from package import *' is invoked.
- How would you define a class attribute that should not be overridden by subclasses?
- To create a new URL pattern in a Django app, you have to add it to the ____ file.