Understanding the Cyrillic Variable Name е vs Latin e in Python
This article explains how the Cyrillic character е looks identical to the Latin e, why using it as a Python variable leads to NameError, demonstrates the Unicode code point differences, and warns about the potential bugs when unintentionally mixing these characters in code.
Today we introduce a new variable name е that looks just like the Latin e , but it is actually a Cyrillic character.
Running the following code in Python shows the problem:
Type "help", "copyright", "credits" or "license" for more information.
>>> е = 1024
>>> e
Traceback (most recent call last):
File "
", line 1, in
NameError: name 'e' is not defined
>>>Even though the variable e appears to be defined, Python raises a not defined error because the defined variable was actually е , a Cyrillic character, not the Latin e .
The Cyrillic е is a Slavic character and its Unicode code point differs from the Latin one:
>> ord('e')
101
>>> ord('е')
1077If you replace a Latin e with the Cyrillic е in your project code, you may encounter subtle bugs that are hard to spot visually.
Afterword
Single‑letter variable names are rare, but mixing Cyrillic and Latin letters is technically possible; however, debugging such bugs can be quite painful.
For more technical tips, feel free to leave a comment.
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.