BartC wrote:
But if you needed a table of the frequencies of letters A to Z...
An N-based array can simply have bounds of ord('A') to ord('Z') inclusive.

That's fine if your language lets you have arrays with
arbitrary lower bounds.

But if the language only allows a fixed lower bound, and
furthermore insists that the lower bound be 1, then your
indexing expression becomes:

   table[ord(letter) - ord('A') + 1]

If a language is only going to allow me a single lower
bound, I'd rather it be 0, because I can easily shift
that by whatever offset I need. But if it's 1, often
I need to cancel out an unwanted 1 first, leading to code
that's harder to reason about.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to