Skip to content
Naming Conventions
step 1/5

Reading — step 1 of 5

Read

~1 min readCommon Rules

Naming Conventions

Python (PEP 8):

  • snake_case for functions, variables, modules.
  • CamelCase for classes.
  • UPPER_CASE for constants.
  • Prefix _ for private.
  • Prefix __ for name mangling.

Bad names:

  • Single letter (except i, j, k, x, y in math contexts).
  • Camel case where snake expected.
  • Names that shadow builtins (list, dict, id, type).
python

Other languages have their own conventions:

  • JS: camelCase for vars/functions, PascalCase for classes/components.
  • Rust: snake_case everywhere, SCREAMING for consts.
  • Go: camelCase private, CamelCase exported (compiler enforces).

Linters often allow project-level overrides (function-naming-style: "any").

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…