파이썬 모듈에서 내보낼 함수명 모으기
import sys
def export(fn):
mod = sys.modules[fn.__module__]
if hasattr(mod, '__all__'):
mod.__all__.append(fn.__name__)
else:
mod.__all__ = [fn.__name__]
return fn
from lib import export
__all__ = [] # optional - we create a list if __all__ is not there.
@export
def foo(): pass