封装结构:
World\
__init__.py
Chip\
__init__.py
grass.py
snow.py
water.py
(两个__init__.py
s 都是空的。)当我这样做时,from world.chip import *
我可以使用grass.Grass
,但不能使用snow.Snow
。为什么是这样?
MUSIC = {
grass.Grass: "mus_grass",
snow.Snow: "mus_snow",
water.Water: "mus_water",
"default": "mus_grass"
}
NameError: name 'snow' is not defined