LBYL vs EAFP - Est's Blog

LBYL vs EAFP

Look Before You Leap

if key in mapping:
    return mapping[key]

Ask Forgiveness than Permission

try:
    return mapping[key]
catch KeyError:
    pass

via

Comments