什么是 PEP-249?

What is PEP-249?

PEP-249 Python 数据库模块(例如 psycopg)应该遵循的“规则”吗?

PEP-249 不是任何 Python 代码,class 或可以“触摸”的东西,或者已经(本机)在 Python 本身内的东西吗?

PEP-249 是 Python 语言将使用的数据库模块的基础吗?

取自PEP-249 introduction:

This API has been defined to encourage similarity between the Python modules that are used to access databases. By doing this, we hope to achieve a consistency leading to more easily understood modules, code that is generally more portable across databases, and a broader reach of database connectivity from Python.

PEP,即 Python 增强提案,就是:提案(参见 PEP-1)。在这种情况下,它是一个标准的、“规范的”API 数据库设计的提议。它不一定是“土地法”,而是供建造此类 APIs 的人参考。

社区聚集在一起,认为提出一些共同点并将其作为 PEP 发布可能是个好主意。 PEP 被接受,现在它将被视为一种标准。

是否遵循此标准取决于每个特定库的维护者。这都是开发者之间的协议问题。