Language Syntax

Identifier — Python syntax

Identifiers may begin with a permitted Unicode letter-like character or underscore, with additional permitted continuation characters. Python normalizes identifiers to NFKC during parsing; keywords remain reserved and soft keywords are contextual. isidentifier alone does not reject keywords. The spelling must not be a reserved keyword even if the string passes isidentifier().

Formal Syntax & Structure

python syntaxpython
name | _name | Unicode_identifier

Return Value

object

Value obtained by evaluating this expression; see description for context and constraints.

Working Example

Example Snippetpython
نام = 7import keywordprint((نام,'نام'.isidentifier(),keyword.iskeyword('class')))
Python Reference