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.