Best afterTruthiness: what counts as true

and / or / not — and what or returns

Reading x == 1 or 2 as 'x is 1 or 2' is the classic boolean trap. Python groups it as (x == 1) or 2, and or hands back an operand, not always a tidy True/False. Watch what actually lands in match.

Check whether x (which is 5) is equal to 1 or 2.

x == 1 or 2 is always truthy execution-derived · CPython
variables
state after line 1 runs
variablevalue
x5
step 1 / 2

Click a line, drag the slider, or use the keys.

What you are looking at

Watch match closely — the value may not even be a boolean.

Every state you see came from running the program under CPython's tracer at build time — see how GlassBox stays honest.