DEV Community

Super Kai (Kazuya Ito)
Super Kai (Kazuya Ito)

Posted on

Identifier in Python

Buy Me a Coffee

*Memo:

  • My post explains naming convention.
  • My post explains a variable assignment.
  • My post explains a function (1).

An identifier:

  • can have letters, _ and the digits except for the 1st character.
  • can be a reserved soft keyword.
  • cannot start with a digit.
  • cannot be a reserved keyword.
  • Identifiers and keywords explains an identifier more.

<Reserved keywords>:

False await else import pass
None break except in raise
True class finally is return
and continue for lambda try
as def from nonlocal while
assert del global not with
async elif if or yield

<Reserved soft keywords>:

match case type _

<Variable>:

True_100 = 'abc' tRuE_100 = 'abc' _True100 = 'abc' True100_ = 'abc' match = 'abc' case = 'abc' type = 'abc' _ = 'abc' # No error  True-100 = 'abc' 100_True = 'abc' True = 'abc' class = 'abc' def = 'abc' # Error 
Enter fullscreen mode Exit fullscreen mode

<Function & Parameter>:

def True_100(True_100): pass def tRuE_100(tRuE_100): pass def _True100(_True100): pass def True100_(True100_): pass def match(match): pass def case(case): pass def type(type): pass def _(_): pass # No error  def True-100(True-100): pass def 100_True(100_True): pass def True(True): pass def class(class): pass def def(def): pass # Error 
Enter fullscreen mode Exit fullscreen mode

<Class>:

class True_100: pass class tRuE_100: pass class _True100: pass class True100_: pass class match: pass class case: pass class type: pass class _: pass # No error  class True-100: pass class 100_True: pass class True: pass class class: pass class def: pass # Error 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)