Identifier the name itself says a lot about itself, Identify or Identification and Identification can be done by naming.
So identifier is basically the name of the variable, class, function etc.
- x= 10 (Here x is a identifier which is a variable stores the value of type int.)
- def function1() : (Here function1 is a identifier which is a function).
A name cannot be given directly, we need to follow some rules to write a identifier which are…
- Identifier can be a combination of letters in lowercase (a-z) or uppercase (A-Z) or digits (0-9) or an underscore.
- Identifier cannot start with number or digit.
- Keywords cannot be and should not be used as identifier.
- No special symbol except underscore(_) is allowed.
- Identifier can be of any length.
Some of the valid identifiers are
myClass, number1, number_2, var1 etc.
Python Reserved Words:
Reserved words are keywords which cannot be used as an identifiers. The compiler is well aware of these words and will always take them as reserved words if tried in place of identifiers.
Basically reserved words makes an programming language, master these reserved words half of your job is done.
There are in all 33 Reserved words in Python Language.
- True (Capital T).
- False (Capital F).
- None (Capital N).
We will see in details all these keywords in upcoming tutorials.
If we want to list down all the keywords just type
>> import keyword
This will list down all the keywords.
I made this very small not to make it lengthy and boring. Its better to take small steps understand throughly and go on.
So, its time for Note: In the previous tutorial we studied Python is platform Independent and also read that it can be blend with C/CPP/Java etc code…. but here is the drawback if Python is blend with any of the Platform dependent language Python will lose it platform independent feature.