语法
本质就是一个string list。 example from https://github.com/balancap/SSD-Tensorflow/blob/master/deployment/model_deploy.py#L111
__all__ = [
'create_clones',
'deploy',
'optimize_clones',
'DeployedModel',
'DeploymentConfig',
'Clone',
]
作用
定义使用from xxx import *时能从xxx导入的变量。
示例
test_all__.py
__all__ = ['a', 'b']
a = 1
b = 2
c = 3
test_all__2.py
from test_all__
import *
print a
print b
try:
print c
except:
print 'c is not imported'
python test_all_2
.py
输出:
1 2 c is not imported
References
http://blog.csdn.net/orangleliu/article/details/49848413