Looking at some of the code other people have written for the project I am currently working on, I often see if statements in the following form.
if condition:
do this
else:
pass
Is there a reason pass
is used here? Could the entire else
statement not just be left out? Why would you include the section with pass
? Similarly I also see this:
if condition:
pass
else:
do this
Why would you write the code this way, when you could do it this way:
if not condition:
do this
Is there a reason for using the pass
command that I am missing, or are these uses of pass
superfluous?