This question already has an answer here:
- Does Python support short-circuiting? 3 answers
I'm currently new to python, and right now I'm trying to condense some code. I currently have code such that:
if(object.function(1)):
if(object.function(2)):
Where statements are functions that return a true or false, depending on what happened inside them. What I am wondering is if I type this into a single if-or line, like this,
if(object.function(1) or object.function(2)):
will it only perform the first function if it returns true, or will it also perform the 2nd function even if function(1) had already let the if pass?
Aucun commentaire:
Enregistrer un commentaire