Подтвердить что ты не робот

Разрешенные символы в именах функций Python

Существуют ли другие допустимые символы в именах функций Python, кроме алфавитных символов, цифр и символов подчеркивания? Если да, то каковы они?

4b9b3361

Ответ 1

Не в Python 2.x. Из документы:

identifier ::=  (letter|"_") (letter | digit | "_")*
letter     ::=  lowercase | uppercase
lowercase  ::=  "a"..."z"
uppercase  ::=  "A"..."Z"
digit      ::=  "0"..."9"

В Python 3 он расширился:

identifier   ::=  xid_start xid_continue*
id_start     ::=  <all characters in general categories Lu, Ll, Lt, Lm, Lo, Nl, 
                   the underscore, and characters with the Other_ID_Start property>
id_continue  ::=  <all characters in id_start, plus characters in the categories 
                   Mn, Mc, Nd, Pc and others with the Other_ID_Continue property>
xid_start    ::=  <all characters in id_start whose NFKC normalization 
                   is in "id_start xid_continue*">
xid_continue ::=  <all characters in id_continue whose NFKC normalization 
                   is in "id_continue*">

The Unicode category codes mentioned above stand for:

Lu - uppercase letters
Ll - lowercase letters
Lt - titlecase letters
Lm - modifier letters
Lo - other letters
Nl - letter numbers
Mn - nonspacing marks
Mc - spacing combining marks
Nd - decimal numbers
Pc - connector punctuations
Other_ID_Start - explicit list of characters in PropList.txt 
                 to support backwards compatibility
Other_ID_Continue - likewise