我越来越多地使用Python,并且我一直__all__在不同的__init__.py文件中看到变量集.有人可以解释这是做什么的吗?
我将我的test.py文件拆分成多个文件,比如
app
app\models.py
app\views.py
app\tests
app\tests__init__.py
app\tests\test_bananas.py
app\tests\test_apples.py
Run Code Online (Sandbox Code Playgroud)
和导入如下__init__.py:
from test_bananas import BananasTest
from test_apples import ApplesTest
Run Code Online (Sandbox Code Playgroud)
pyflakes给我错误
modules/app/tests/__init__.py:5: [E] PYFLAKES:'BananasTest' imported but unused
modules/app/tests/__init__.py:5: [E] PYFLAKES:'ApplesTest' imported but unused
Run Code Online (Sandbox Code Playgroud)
试过这个也
from test_bananas import *
from test_apples import *
Run Code Online (Sandbox Code Playgroud)
再次pyflakes给我错误
PYFLAKES:'from test_bananas import *' used; unable to detect undefined names
PYFLAKES:'from test_apples import *' used; unable to detect undefined names
Run Code Online (Sandbox Code Playgroud)