Python etc / str.__getitem__ quirks

Published: 6 May 2021, 18:00

Since Python doesn’t have a char type, an element of str is always str:

# '@'

This is an infinite type and you can’t construct in a strictly typed language (and why would you?) because it’s unclear how to construct the first instance (thing-in-itself?). For example, in Haskell:

Prelude> str = str str

<interactive>:1:7: error:
    • Occurs check: cannot construct the infinite type: t1 ~ t -> t1