Python Control flow with line divisions -
this question has answer here:
- boolean operations 5 answers
currently maintaining large application in python , came across this:
if \ , b or c: d elif \ , c: d else: e
where a
, b
, c
boolean expressions, , d
, e
statements executed. d
same statement in each clause, if
, elif
conditions cause same sequences executed (if understanding correct).
but d
different each block; how logic evaluated, particularly in if
block? like:
if , (b or c)
which equivalent to
if (a , e)
for e
= b or c
; or more like
if (a , b) or c
which equivalent to
if (e or c)
for e
= a , b
?
my intuition it's former, wanted sure.
breaking line \
code cleanliness, not affect execution or evaluation order. since and
has higher precedence or
, condition evaluated (a , b) or c
.
Comments
Post a Comment