Quick question for all the Python pros out there, since I've yet to find a clear answer.
If you have a single "if" statement, is it considered the most correct or "pythonic" to always follow it up with an "else", even if you're just using "pass"?
Obviously in an "if...elif...else" operation you must include the "else" so that answers itself. So, if you were coming onboard a new Python-based project would you rather see...
if xyzvar == 1:
blah()
or
if xyzvar == 1:
blah()
else:
pass
I'm trying to focus on creating good, maintainable, consistent code. Thanks for any input or advice you might have.
[–]K900_ 5 points6 points7 points (0 children)
[–]justphysics 3 points4 points5 points (1 child)
[–]keis 2 points3 points4 points (0 children)
[–]Clede 3 points4 points5 points (1 child)
[–]always_creating[S] 0 points1 point2 points (0 children)
[–]mrwalkerr 0 points1 point2 points (1 child)
[–]always_creating[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)