Python Part-20 (class and static methods), use of @classmethod and @staticmethod

Опубликовано: 27 Февраль 2026
на канале: Varteta Learning Platform
82
1

#classmethod
#staticmethod

About class and static methods.
@classmethod is used for the class methods and no need of any attribute decorator for class level variables.
Takes class name as the first argument and not the reference to the instance unlike for normal methods.
@staticmethod used for static methods not having any relation to class or reference of the instannce of a class. They are just utility functions.

_str_ method override in your class to display the information you want to display

References:
https://www.tutorialspoint.com/class-...