str.__getitem__
quirks
Since Python doesn't have a char
type, an element of str
is always str
:
'@pythonetc'[0][0][0][0][0]
# '@'
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