政治公众人物8states
Wildcard imports (from import *) should be avoided, as they make it unclear which names are present in the namespace, confusing both readers and many automated tools.
然而official documentation是矛盾的:
to use Tkinter all you need is a simple import statement:
import tkinter
^{pr2}$Or, more often:
这是“文档错误”吗?在
我在这一点上提出了错误issue 32830,并且一致认为(Python核心开发人员达成的共识)虽然
from tkinter import *
确实违反了pep8,但这是一个合理的例外,因为tkinter
“提供了大量的名称(主要是像RIGHT或VERTICAL这样的常量),这些名称不需要前缀就可以使用。”此外,pep8状态“没有打破向后兼容性只是为了遵守这个政治公众人物!”由于目前tkinter经常以这种方式进口,这种观点在这里也适用。在相关问题 更多 >
编程相关推荐