比方说,我有这样的代码:调用不同类从一个类的方法在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
我希望能够从Class2中,反之亦然调用类class1的解析。我知道用c + +这可以很容易地做到这一点
class1::parse(array)
我将如何做python的等效?
这是他们所谓的一种“代码味道”。它看起来像一个糟糕的设计。什么是想要这样做的原因? – 2010-07-22 19:47:21