如果内部的模块名称和类名称具有相同的名称,那么Python中是否存在风险?(Are there any risks in Python if the module name and class name from inside had identical names?)
我想知道是否有任何风险在模块内使用完全相同的名称作为模块和类。
I would like to know if there any risks to use the exact same name for module and a class from inside the module.
最满意答案
PEP 8说模块应该有简短的全小写名称,而类名称使用CapWords约定。 所以,如果你对一个模块和一个类有相同的名字,你不会遵循这些风格约定。
从技术上讲,没有风险。
The PEP 8 says that modules should have short, all-lowercase names, while class names use the CapWords convention. So, if you have the same name for a module and a class, you're not following those style conventions.
Technically, there's no risk at all.
更多推荐
发布评论