Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道这是非常邪恶的,但是是否可以将对象添加到另一个模块的全局变量中,例如:
#module dog.py import cat cat.globals.addVar('name','mittens')
和
#module cat.py print name #mittens
setattr(cat, 'name', 'mittens')
或者
cat.name = 'mittens'