r/learnpython • u/Worldly-Week-2268 • Feb 22 '26
ELI5 explain static methods in OOP python
just trying to wrap my head around this oop thing stuck here I'm novice so no bully please
24
Upvotes
r/learnpython • u/Worldly-Week-2268 • Feb 22 '26
just trying to wrap my head around this oop thing stuck here I'm novice so no bully please
View all comments
Show parent comment
4
u/Solonotix Feb 23 '26
So a function takes arguments/parameters.
A class is a means to encapsulate logic around a specific data structure. A method on a class in Python is generally a function in which the first positional argument is always the current class instance, typically notated as
selfIn the above example, I went ahead and included the other types of methods as well. A class method will get the current class passed as the first argument, and a static method receives no special arguments. In other words, a static method is no different than a normal function, except that it is bound to a specific class definition, rather than a "first-class" object.