A
andychambers2002
Hi,
I'm trying to write a method that needs to know both the class name and
the instance details
class A:
@classmethod
def meth(cls, self):
print cls
print self
a = A()
a.meth(a)
The above code seems to work as intended. Could the same effect be
achieved using a second decorator in addition to the @classmethod. I
tried
def instancemethod(self):
return self.meth(self)
@instancemethod
@classmethod
def meth(cls, self):
#do stuff
but it didn't work. Any suggestions?
Regards,
Andy
I'm trying to write a method that needs to know both the class name and
the instance details
class A:
@classmethod
def meth(cls, self):
print cls
print self
a = A()
a.meth(a)
The above code seems to work as intended. Could the same effect be
achieved using a second decorator in addition to the @classmethod. I
tried
def instancemethod(self):
return self.meth(self)
@instancemethod
@classmethod
def meth(cls, self):
#do stuff
but it didn't work. Any suggestions?
Regards,
Andy