Thanks for this work, I'm discovering nooks and crannies of Python that I wasn't previously aware of.
For the following section, I wanted to point out that what seems to matter is order of definition of the class attributes.
|
def bark(self): |
|
return "instance bark" |
|
|
|
def growl(self): |
|
return "instance growl" |
|
|
|
@staticmethod |
|
def bark(): |
|
return "staticmethod bark, arg: None" |
|
|
|
@classmethod |
|
def growl(cls): |
|
return "classmethod growl, arg: cls=" + cls.__name__ |
The classmethod and staticmethod are redefining the instance methods. If order of each of bark and growl is flipped, the instance method will redefine the static/class method.