Reading — step 1 of 5
Read
~1 min readCommon Rules
Naming Conventions
Python (PEP 8):
snake_casefor functions, variables, modules.CamelCasefor classes.UPPER_CASEfor constants.- Prefix
_for private. - Prefix
__for name mangling.
Bad names:
- Single letter (except
i,j,k,x,yin math contexts). - Camel case where snake expected.
- Names that shadow builtins (
list,dict,id,type).
python
Other languages have their own conventions:
- JS:
camelCasefor vars/functions,PascalCasefor classes/components. - Rust:
snake_caseeverywhere,SCREAMINGfor consts. - Go:
camelCaseprivate,CamelCaseexported (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…