在Python中从不同类调用方法
假设我有这段代码:
class class1(object):
def __init__(self):
#don't worry about this
def parse(self, array):
# do something with array
class class2(object):
def __init__(self):
#don't worry about this
def parse(self, array):
# do something else with array
我想让class1能够从class2调用parse方法,反过来也可以。我知道在C++中,这个操作可以很简单地做到:
class1::parse(array)
那么在Python中,我该怎么做呢?