str() is an R function that reports on the structure of an R object)str(as.roman("VII"))## Class 'roman'  int 7X=10 (for example) and use that assignment to translate values in the string. I tried to explain, not very clearly, that this was mixing up logical levels (between a symbol and a value of a string). In R I would do this asX <- 10
r <- "XVI"
get(substr(r,1,1))## [1] 10I asked StackOverflow how to do this in Python. The answer:
X = 10
r = "XVI"
print(locals()[r[0]])## 10This question is an example of the use-mention distinction, which is played with in Lewis Carroll’s Through the Looking Glass; are we interested in the value of the symbol X, or the value of the symbol named "X"?
PPS: This feels like an example of Gelman’s God is in every leaf of every tree …