Key difference with JS - Python enforces snake_case for all variable and function names while JavaScript allows for camelCase for function arguments and local variables.
- Function and Variable Naming: Uses lowercase letters, words separated by underscores (
_
). Popular convention is snake_case for all function and variable names (my_function
,interesting_variable
). - Class Naming: Traditionally uses PascalCase (first letter of each word capitalized) for classes (
MyClass
). - Constants: Typically written in ALL_CAPS_WITH_UNDERSCORES (
CONSTANT_NAME
). - Modules and Packages: Often use lowercase with underscores (
my_module.py
).