One can do something like this:
class master:
@combomethod
def foo(param):
param.bar() # Param could be type as well as object
class slaveClass( master ):
@classmethod
def bar(cls):
print("This is class method")
slaveType = slaveClass
slaveType.foo()
class slaveInstance( master ):
def __init__(self, data):
self.data = data
def bar(self):
print("This is "+self.data+" method")
slaveType = slaveInstance("instance")
slaveType.foo()
combomethod is defined in "Creating a method that is simultaneously an instance and class method".
My question is, why is it like this, that default first parameter can't be used as parameter of comboclass? Or at least, why can't I pass object to classmethod as the first parameter? I know the difference between classmethod and instancemethods, and I know decorators, but I might not understand how built-in @classmethod and self parameter passing is made. Is there a technical limitation? Or, why isn't combomethod allready built in?