【发布时间】:2016-02-09 05:46:31
【问题描述】:
我有一个具有这种结构的 python 程序:
import sys
class A:
def __init__(self):
...
def func(self, other, args):
z = something
n = B.start(z)
print n
def other_funcs(self, some, args):
...
class B:
def __init__(self):
self.start(z)
def start(self, z)
k = something
return k
if __name__ == '__main__'
A()
当我生成z 时,我想将它提供给 B 类,然后 B 再次为我返回 k。
但错误存在:
TypeError: unbound method start() must be called with B instance as first argument (got list instance instead)
【问题讨论】:
-
不应该
self.start(z)说z没有定义吗?