Choose variable, function, and parameter names that accurately reflect their content, type, and purpose. Avoid misleading names that don't match the actual data or functionality they represent.
Choose variable, function, and parameter names that accurately reflect their content, type, and purpose. Avoid misleading names that don’t match the actual data or functionality they represent.
Key principles:
_list
suffix for non-list variables)Examples of improvements:
# Misleading - suggests it's a list but contains length
holding_tokens_list = len(tokens) # Bad
# Clear and accurate
holding_tokens_count = len(tokens) # Good
# Informal terminology
onfly_info = get_dispatch_info() # Bad
# Standard terminology
in_flight_info = get_dispatch_info() # Good
# Overly verbose
should_fuse_allreduce_residual_rmsnorm = True # Bad
# Concise but clear
should_allreduce_fusion = True # Good
This practice prevents confusion, reduces debugging time, and makes code more maintainable by ensuring names serve as accurate documentation of the code’s intent.
Enter the URL of a public GitHub repository