Choose names for variables, methods, parameters, and fixtures that clearly communicate their purpose, content, and behavior. Names should be self-documenting and consider future code evolution.
Choose names for variables, methods, parameters, and fixtures that clearly communicate their purpose, content, and behavior. Names should be self-documenting and consider future code evolution.
For method names:
enable_xxx()
/disable_xxx()
over ambiguous patterns like with_xxx()
/without_xxx()
# Less clear:
def with_padding(self, direction="right", ...):
# ...
# More clear:
def enable_padding(self, direction="right", ...):
# ...
For variables and parameters:
# Less descriptive - unclear what these files contain:
@pytest.fixture(scope="session")
def precompiled_files(data_dir):
# ...
# More descriptive - clearly indicates purpose and content:
@pytest.fixture(scope="session")
def serialized_files(data_dir):
# ...
Maintain consistency in parameter naming across similar implementations to establish predictable patterns for API users.
Enter the URL of a public GitHub repository