Edge Cases¶
Guidance¶
- Keep the main path clear; avoid branching noise when possible.
- Prefer EAFP when it makes the intent and flow simpler.
Bad Example (LBYL)¶
def counter_lbyl(values):
result = {}
for key in values:
if key in result:
result[key] += 1
else:
result[key] = 1
return result