Sunday, November 3, 2019

Correct and incorrect variable names

Note that the same restrictions apply to function names.
Python does not impose restrictions on the length of variable names, but that doesn't mean that a long variable name is always better than a short one.
Here are some correct, but not always convenient variable names:
MyVariableit34Exchange_Ratecounterdays_to_christmasTheNameIsSoLongThatYouWillMakeMistakesWithIt_.

Moreover, Python lets you use not only Latin letters but also characters specific to languages that use other alphabets.
These variable names are also correct:
Adiós_Señorasûr_la_merEinbahnstraßeпеременная.
And now for some incorrect names:
10t (does not begin with a letter), Exchange Rate (contains a space)

No comments:

Post a Comment