【发布时间】:2013-07-10 08:53:39
【问题描述】:
是否有在静态方法中引用自己的类的简写?
假设我有这段代码:
class SuperLongClassName(object):
@staticmethod
def sayHi():
print 'Hi'
@staticmethod
def speak():
SuperLongClassName.sayHi() # Is there a shorthand?
【问题讨论】:
-
让你的类名更短。
-
不带类名直接调用
-
你应该使用类方法而不是静态方法 [更多信息在这里][1] [1]:stackoverflow.com/questions/9744223/…
标签: python