ord() 函数的名称代表什么?

What does the name of the ord() function stand for?

官方Python文档解释ord(c)

ord(c):
Given a string representing one Unicode character, return an integer representing the Unicode code point of that character. For example, ord('a') returns the integer 97 and ord('€') (Euro sign) returns 8364. This is the inverse of chr().

没有说明ord的意思,google搜索没有帮助。

它的由来是什么?

代表"ordinal".

我记得最早使用ord是在Pascal。在那里,ord() 返回其参数的序数值。对于字符,这被定义为 ASCII 代码。

Modula-2也使用了相同的约定。

后来,Python(以及 PHP,SQL 等的一些方言)遵循了这个约定,只是现在他们更可能使用 Unicode 而不是ASCII.

很可能术语(和函数名称)的起源比 Pascal 更早。

Return单字符字符串的整数序数

我从 ord.doc python 命令行中获取了这个。 ord 表示一个字符的序号。