Booleans and truthiness

Any value can stand in for a condition. These are falsy: False, None, 0, 0.0, "", and empty containers like [] and {}. Almost everything else is truthy. So if items: means "if the list is not empty".

and and or don't return True or False. They return one of their operands. a or b gives a if it is truthy, otherwise b. That makes name or "anonymous" a handy default.

Both short-circuit: or stops at the first truthy value and and stops at the first falsy one. So items and items[0] never indexes an empty list.

A common bug: limit = given or 10 turns a real 0 into 10. Use 10 if given is None else given when 0 is a valid value.

Run it, then set given = 5.