Well, I finally ran into a Python Unicode problem, sort of

Marko Rauhamaa marko at pacujo.net
Sun Jul 3 17:25:24 EDT 2016


Random832 <random832 at fastmail.com>:

> Being able to put any character in a symbol doesn't make those strings
> identifiers, any more than passing them to getattr/setattr (or
> __import__, something's __name__, etc) does in Python.

>From R7RS, the newest Scheme standard (p. 61-62):

     7.1.1. Lexical structure
     [...]
     〈vertical line〉 → |
     [...]
     〈identifier〉 → 〈initial〉 〈subsequent〉*
          | 〈vertical line〉 〈symbol element〉* 〈vertical line〉
          | 〈peculiar identifier〉
     〈initial〉 → 〈letter〉 | 〈special initial〉
     〈letter〉 → a | b | c | ... | z
         | A | B | C | ... | Z
     〈special initial〉 → ! | $ | % | & | * | / | : | < | =
         | > | ? | ^ | _ | ~
     〈subsequent〉 → 〈initial〉 | 〈digit〉
         | 〈special subsequent〉
     〈digit〉 → 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
     〈hex digit〉 → 〈digit〉 | a | b | c | d | e | f
     〈explicit sign〉 → + | -
     〈special subsequent〉 → 〈explicit sign〉 | . | @
     〈inline hex escape〉 → \x〈hex scalar value〉;
     〈hex scalar value〉 → 〈hex digit〉 +
     〈mnemonic escape〉 → \a | \b | \t | \n | \r
     〈peculiar identifier〉 → 〈explicit sign〉
         | 〈explicit sign〉 〈sign subsequent〉 〈subsequent〉*
         | 〈explicit sign〉 . 〈dot subsequent〉 〈subsequent〉*
         | . 〈dot subsequent〉 〈subsequent〉*
     〈dot subsequent〉 → 〈sign subsequent〉 | .
     〈sign subsequent〉 → 〈initial〉 | 〈explicit sign〉 | @
     〈symbol element〉 →
         〈any character other than 〈vertical line〉or \〉
         | 〈inline hex escape〉 | 〈mnemonic escape〉 | \|


Marko



More information about the Python-list mailing list