Python: Allowed Characters in Identifiers

By Xah Lee. Date: .

Unicode Characters in Variable and Function Names

Python 3 allows Unicode characters in variable and function names, but they must be letter characters. Non-letter characters are not allowed.

def φ(n):
    return n + 1

α = 4
print(φ(α))
# 5
♥ = 4

print(♥)

#     ♥ = 4
#     ^
# SyntaxError: invalid character '♥' (U+2665)

Python, Unicode