简体   繁体   English

Python包结构-子模块

[英]Python package structure - submodules

My question is more theory than specific, but if you are developing a Python package where two subpckages (same level) need each other to function, should you keep them still as separate child packages because their organization makes sense to separate based off their purposes or make them a single subpackage because they are necessarily intertwined? 我的问题是理论而非具体问题,但是,如果您要开发一个Python程序包,其中两个子程序包(相同级别)需要彼此配合运行,则应将它们保持为单独的子程序包,因为它们的组织可以根据其目的进行分离,或者使它们成为单个子包,因为它们必定相互缠绕?

I am not sure if there is a straightforward answer here and would like some input from the more seasoned Python community- what is considered "more Pythonic"? 我不确定这里是否有简单的答案,是否希望从经验更丰富的Python社区中获得一些意见-什么被视为“更多Python风格”?

Subpackages should be in separate child packages that make sense in terms of structure and functionality. 子程序包应该放在单独的子程序包中,这些子程序包在结构和功能方面都有意义。

Just as classes, it makes them easier to understand and maintain and upgrade in the future. 与类一样,它使它们将来更易于理解,维护和升级。 It also makes them potentially reusable for other applications. 这也使它们有可能重新用于其他应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM