Home>Article>Backend Development> what is a python identifier

what is a python identifier

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼 Original
2019-07-23 11:12:31 30832browse

what is a python identifier

Identifier

Identifier (IDentifier) refers to a symbol used to identify an entity. It has different meanings in different application environments.

In daily life, an identifier is used to specify something or a person. To use it, his or her name; when solving equations in mathematics, we often use this or that Variable name or function name;

In programming languages, identifiers are names used by users when programming. There are also names for variables, constants, functions, and statement blocks; we all call them identifiers.

Related recommendations: "Python Tutorial"

1.1 Rules for identifiers

Identifiers consist of letters, underscores and numbers composed, and cannot begin with a number.

Examples are as follows:

fromNo12 my_Boolean Obj2 myInt test1 Mike2jack My_tExt _test jack_rose

Error examples are as follows:

from#12 my-Boolean 2ndObj test!32 haha(da)tt int jack&rose G.U.I

Note: Identifiers in Python are case-sensitive.

what is a python identifier

1.2 Naming Rules

(1) See the name and know the meaning

Choose a meaningful name, Try to know what it means at a glance (to improve code readability). For example: the name can be defined as name, and the student can be defined as student.

(2) Camel case nomenclature

Lower camel case nomenclature: The first word starts with a lowercase letter; the first letter of the second word is capitalized, for example: myName , aDog

upper camel case: The first letter of each word is capitalized, for example: FirstName, LastName

what is a python identifier

However, there is another nomenclature that is more popular among programmers, which is to use underscore "_" to connect all words, such as send_buf.

The above is the detailed content of what is a python identifier. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn