Prompt
Choose variable, method, class, and parameter names that clearly communicate their purpose and avoid ambiguity. Names should be self-documenting and specific rather than generic or vague.
Key principles:
- Be specific about purpose: Use
max_parse_retriesinstead ofadapter_retry_count, orshould_document_methodinstead ofis_documented_method - Avoid generic names: Replace vague names like
InputFieldorenumerate_fieldswith descriptive ones likeUserProfileorget_field_description_string - Use meaningful variable names: Instead of confusing names like
input_opt_rightandinput_opt_left, use clear names likeinput1andinput2with explanatory comments - Be consistent across functions: If using
train_methodin one function, use it consistently rather than switching tomethodelsewhere
Example:
# Poor naming - vague and confusing
def enumerate_fields(fields: dict) -> str:
adapter_retry_count = 0
input_opt_right = "test"
# Better naming - descriptive and clear
def get_field_description_string(fields: dict) -> str:
max_parse_retries = 0
user_input = "test"
This approach makes code more maintainable and reduces the cognitive load for other developers reading your code.