Explain the difference between `@staticmethod` and `@classmethod`.
Answer Posted / nashiinformaticssolutions
`@staticmethod` is used for methods that don’t require access to the instance (`self`) or class (`cls`). `@classmethod` is used when a method needs access to the class (`cls`), but not the instance (`self`).
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are local variables in python?
What does flush do in python?
Write a program in python to produce star triangle.
What is *kwargs and **kwargs?
Difference between __str__ and __repr__ in python?
What does tuple mean?
What are attributes in python?
Is python better than ruby?
Write a program in python to check if a sequence is a palindrome.
What does serialization mean in python?
What a blank curly brace initialize? A dictionary or a set?
What is the most popular ide for python?
What is instance method?
What is python main function and write one good example?
What is shell scripting in python?