我写了以下程序,但它没有用。它有什么问题?
public function tasks()
{
return $this->hasMany('App\Task');
}
运行时的错误是:
def h(self):
print "Hello World"
if __name__ == '__main__':
hello = type('HelloThread', bases=(threading.Thread,object), dict=dict(hello=h))
我的python版本是python2.7
答案 0 :(得分:3)
错误明确指出type.__init__() takes no keyword arguments
,因此在发起type
时不要使用关键字参数:
hello = type('HelloThread', (threading.Thread, object), dict(hello=h))