Best afterA comparison is a yes/no value

Truthiness: what counts as true

Python lets any value stand in a yes/no test: empty containers, 0, '' and None are 'falsy', everything else 'truthy'. But truthy is not the same as equal to True — and confusing the two skips the branch you wanted.

Set label to 'has items' when the list has something in it, otherwise 'empty'.

Comparing a list to True execution-derived · CPython
3    label = "has items"4else:
variables
state after line 1 runs
variablevalue
items[3,8]
step 1 / 3

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

What you are looking at

Watch which branch runs, and what label ends up as.

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