Prompt
Choose names that clearly convey their purpose, role, and meaning while maintaining consistency with established patterns in the codebase. Names should be self-documenting and unambiguous to future maintainers.
Key principles:
-
Semantic clarity: Names should reflect their actual purpose and role in the system architecture. For example, use
receiver_hostinstead ofpeer_host_namewhen the architecture has a clear receiver-sender relationship, ornum_skip_prefix_chunkinstead ofnum_skip_chunkwhen the meaning is “number of prefix chunks to skip”. -
Consistency with patterns: Follow established naming conventions in the codebase. If other batch operations use
batched_xxxpattern, usebatched_containsinstead ofbatch_contains. Similarly, maintain consistency between related functions like usingbatchedinstead of mixinglayerwiseandbatched. -
Avoid ambiguous abbreviations: Use clear variable names instead of cryptic abbreviations. Replace unclear names like
anwandanwswith descriptive names likecache_exists_results. -
Distinguish similar entities: When multiple files or classes serve similar but distinct purposes, use names that clearly differentiate them. Instead of
disagg_proxy_server.pyanddisagg_proxy_server_original.py, use names that describe their specific roles.
Example of good naming:
# Instead of:
def batch_contains(self, keys): pass
anws = self.engine_.batched_contains(keys)
for anw in anws:
if not anw:
# Use:
def batched_contains(self, keys): pass # Consistent with other batched_xxx methods
cache_exists_results = self.engine_.batched_contains(keys)
for cache_exists in cache_exists_results:
if not cache_exists: