我正在编写一个 python 包,想知道放置常量的最佳位置是哪里?
我知道您可以在包中创建一个名为“constants.py”的文件,然后使用 module.constants.const 调用它们,但是不应该有一种方法可以将常量与整个模块相关联吗?例如,您可以调用 numpy.pi,我该怎么做?
此外,模块中的哪个位置是放置模块外部目录路径的最佳位置,我想在其中读取/写入文件?
python module constants
constants ×1
module ×1
python ×1