3 ms·
Wouldn't coding defensively just end up looking like: def f(v): if v is None: return # REST OF f stuff And say you have other functions g, h,
by sophacles 15y ago
Wouldn't coding defensively just end up looking like:
def f(v):
if v is None: return
# REST OF f stuff
And say you have other functions g, h, i, ... each one of those would also start with the:
if v is None: return
portion of the function. This is just a case of DRY.