自导入python模块和将类重新定义为变量有什么好处吗?下面的代码位于test_module.py文件中 .
class some_name():
def __init__(self):
print('Do something here')
if __name__ == "__main__":
import test_module
some_name = test_module.some_name()
我在网上发现了类似的东西(现实生活中的代码) . 它看起来像纯粹的邪恶编码,但也许我错过了一些不明显的好处?