我有一个类,其中有两种方法,一种是静态的,另一种是非静态的:
class Person(object):
def getDetails(self):
Person.change_something(self.name)
@staticmethod
def change_something(name):
return name.upper()
当我创建类 Person 的实例并调用person.getDetails()
时,我收到错误消息 unbound method change_something() must be called with Person instance as first argument (got str instance instead)
。谁能指出我在这里做错了什么?