Python Identifiers
➢ Python Identifiers are user-defined names to represent a variable, function, class, module or any other object. If you assign some name to a programmable entity in Python, then it is nothing but technically called an identifier.
➢ Python language lays down a set of rules for programmers to create meaningful identifiers.
Guidelines for Creating Identifiers in Python.
1. To form an identifier, use a sequence of letters either in lowercase (a to z) or uppercase (A to Z). However, you can also mix up digits (0 to 9) or an underscore (_) while writing an identifier.
For example – Names like shapeClass, shape_1, and upload_shape_to_db are all valid identifiers.
2. You can’t use digits to begin an identifier name. It’ll lead to the syntax error.
For example – The name, 0Shape is incorrect, but shape1 is a valid identifier.
3. Also, the Keywords are reserved, so you should not use them as identifiers.
4. Python Identifiers can also not have special characters [‘.’, ‘!’, ‘@’, ‘#’, ‘$’, ‘%’] in their formation. These symbols are forbidden.
5. Python doc says that you can have an identifier with unlimited length. But it is just the half truth. Using a large name (more than 79 chars) would lead to the violation of a rule set by the PEP-8 standard. It says.Limit all lines to a maximum of 79 characters.
Question :
You are interested in Python....🐍.........
.
No comments:
Post a Comment