Nama dan Token

  • Allowed characters: a-z A-Z 0-9 underscore, and must begin with a letter or underscore.
  • Names and identifiers are case sensitive.
  • Identifiers can be of unlimited length.
  • Special names, customizing, etc. -- Usually begin and end in double underscores.
  • Special name classes -- Single and double underscores.
    • Single leading single underscore -- Suggests a "private" method or variable name. Not imported by "from module import *".
    • Single trailing underscore -- Use it to avoid conflicts with Python keywords.
    • Double leading underscores -- Used in a class definition to cause name mangling (weak hiding). But, not often used.
    • Naming conventions -- Not rigid, but:
    • Modules and packages -- all lower case.
    • Globals and constants -- Upper case.
    • Classes -- Bumpy caps with initial upper.
    • Methods and functions -- All lower case with words separated by underscores.
    • Local variables -- Lower case (with underscore between words) or bumpy caps with initial lower or your choice.
    • Good advice -- Follow the conventions used in the code on which you are working.
  • Names/variables in Python do not have a type. Values have types.

results matching ""

    No results matching ""