vendredi 7 août 2020

Is the "pass" statement neccessary/proper?

I've noticed that if I let Sublime Text 3 autocomplete my python if statements, it gives the following:

if :
    pass

My understanding of pass is that it won't do anything, and can be useful in a more complex loop where you want to exit on a certain condition.

if : won't run on its own, which leads me to think that Sublime includes pass in there for something other than making the code syntactically executable.

Is there a formal reason to include pass, even if your code would work without it?

Aucun commentaire:

Enregistrer un commentaire