我想要实现的是在模块级别拥有class Foo
接口。
# foo.py
class Foo():
def fun(self):
pass
fun():
return Foo().fun() # this is what I want to avoid
# since module and class have
# the same interface
# module_scope_name = Foo() # this is what I want to achieve
# SOLUTION:
fun = Foo().fun
# usage
import foo
foo.fun()