我怎么能一般地调用super()。method(),而不显式传入当前类?

时间:2015-07-31 21:28:32

标签: python

我知道我能做到:

class Foo(Object):
   @classmethod
   def run(cls):
      // do stuff

class Bar(Foo):      
   @classmethod:
   def run(cls):
      super(Bar, cls).run()
      // do more stuff

但是,我想做的更多的是super(cls.__name__, cls).run()。不幸的是,这不起作用,错误:

super(cls.__name__, cls).run(cls)
TypeError: must be type, not str

0 个答案:

没有答案
相关问题