Answer the question
In order to leave comments, you need to log in
Python What is the fundamental difference in writing a condition?
Is there a difference in the execution time of such structures?
And which construction is considered more readable?
if <громадное условие>:
func(x,y,z)
func(x,y,z) if <громадное условие>
Answer the question
In order to leave comments, you need to log in
Let me add to the words of other commentators: it is usually better not to make "enormous conditions", they are difficult to read. Almost always, you can somehow optimize and reduce it, for example, by decomposing it into separate variables, or making a list and setting any()
/ on it all()
, or taking it all into a separate function with a bunch of assert
, instead of catching the condition AssertionError
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question