Which coding style do you prefer, and why?
if case1:
return res1
if case2:
return res2
return res3
or:
if case1:
return res1
elif case2:
return res2
else:
return res3
or:
res = None
if case1:
res = res1
elif case2:
res = res2
else:
res = res3
return res
Reason: I have code that looks like this, and I'm wondering what's the clearest way of expressing it. Personally I can't decide between the 1st and the 2nd, and I wouldn't consider the third.
I was about to tag this language-agnostic, but I realized that functional languages don't have this issue, as it defaults to case 2 =P.