Consider:
class cla(object):
def __init__(self,val):
self.val = val
def met(self):
return self.val + 1
Then cla.met(cla(1))
returns 2
.
Since I don't need an instance of class cla
to use method met
, does this mean it is a class method, even though I haven't used the decorator @classmethod
?
I read https://julien.danjou.info/blog/2013/guide-python-static-class-abstract-methods to understand better what class methods are, but somehow it seems to me that the intended meaning of @classmethod
is already present in the normal methods of a class - and I'm actually quite confused from the examples for there, as they don't even compile.