如果我这样定义一个类a和一个方法b:(在 Python2.7 中)
class a:
def b():
print("hello")
我也不能调用这个方法
a.b()
也不:
a_instance = a(); a_instance.b()
我的问题是:
(1)有没有办法调用b?
(2) 有没有这种用法有意义的情况?
(3) 我认为 b 既不是 astatic method也不是 a instance method。是b一个class method?如果不是,应该命名b为什么?