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

Question:

The official Python documentation explains 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().

It does not specify the meaning of ord, google searches are not helpful.

What’s the origin of it?

Asked By: AbstProcDo

||

Answers:

It stands for “ordinal”.

The earliest use of ord that I remember was in Pascal. There, ord() returned the ordinal value of its argument. For characters this was defined as the ASCII code.

The same convention was also used in Modula-2.

Later, Python (as well as PHP, some dialects of SQL etc) followed this convention, except that these days they’re more likely to use Unicode rather than ASCII.

It could well be that the origins of the term (and the function name) go back further than Pascal.

Answered By: NPE

Return the integer ordinal of a one-character string.

I took this from ord.doc in python command line. ord meaning ordinal of a one character.

Answered By: Karthik