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 is tkinter?
How do I create a variable number of variables?
Explain static class variables in python?
Is it necessary to know c to learn python?
How does break work in python?
How do you count in python?
Can we develop a site using python
What are the benefits of using python?
What is type() and id() will do?
What does %d do in python?
List down some of the pdb commands for debugging python programs?
Does python support inheritance?
Explain garbage collection in python?
How python can be used in software testing?
What is a docstring in python?