Python: Allowed Characters in Identifiers

By Xah Lee. Date: . Last updated: .

Unicode Characters in Variable and Function Names

def φ(n):
    return n + 1

α = 4
print(φ(α))
# 5
import math

deg = math.pi / 180;

print( 90 * deg)
# 1.5707963267948966

# U+B0: DEGREE SIGN
° = math.pi / 180;
#     ° = math.pi / 180;
#     ^
# SyntaxError: invalid character '°' (U+00B0)

Python, Unicode