为什么sqlite3快捷函数被称为“非标准”?

4 python sqlite

我在 Python 中使用了 sqlite3,这execute()会产生歧义。当我使用:

import sqlite3
A = sqlite3.connect('a')
A.execute('command to be executed')
help(A.execute)
Run Code Online (Sandbox Code Playgroud)

我得到了 help() 的输出:

.....
.....
Executes a SQL statement. Non-standard.
Run Code Online (Sandbox Code Playgroud)

但是当我这样执行时:

import sqlite3
A = sqlite.connect('a').cursor()
A.execute('command to be executed')
help(A.execute)
Run Code Online (Sandbox Code Playgroud)

我得到了 help() 的输出:

.....
.....
Executes a SQL statement.
Run Code Online (Sandbox Code Playgroud)

我的疑问是非标准指的是什么?即使是Python文档提供了这些话executeexecute()executemany()以及executescript()在连接对象。

我什至在网上搜索过有关 Python 中非标准快捷方式的信息。但我没有得到任何相关信息。谁能帮我这个?

mkr*_*er1 5

“非标准”函数是类的execute方法sqlite3.Connection

这是一个非标准的快捷方式,它通过调用cursor()方法创建游标对象,execute()使用给定的参数调用游标的方法,并返回游标。

“标准”是指PEP 249 - Python数据库API规范v2.0的哪个sqlite3模块如下。它没有executeConnection类指定方法,但sqlite3模块无论如何都提供了它,这就是它被称为“非标准”的原因。

PEP 249 只指定了模块实现executeCursor类的方法,当然。sqlite3