The choice of variable name underscore and hyphen _-

It is the first time to write more systematic and complex code, so I want to write some things more standardized.
Regarding the variable name, https://unbug.github.io/codelf/, when querying here, char_set, the character set (combined), there is a char-set displayed in it.
So what's going on!

a-1
NameError: name 'a' is not defined
a-1=11
SyntaxError: cannot assign to operator

In Python,-is the minus sign. In C language textbooks, characters, numbers, and underscores.

Then use-situations: Lisp, URL, CSS, etc., they can semantically judge whether it is a minus sign or a hyphen

However, programming languages ​​such as C and Python are more rigorous and efficient, so there is no need to make unnecessary judgments, and Java has more $ to use.

In compatible languages, because double-clicking the variable can include the underscore, this is an advantage, so some programmers prefer to use the underscore.

Guess you like

Origin blog.csdn.net/jhsxy2005/article/details/113744196