Good technique for color masks with opencv

Your first piece of code selects for exactly 0 degrees of hue. That stop sign will probably not have exactly that hue. Hence, not selected.

Your second piece of code gives some range of hues. That's why it can catch the stop sign.

The second piece of code has to split the hue range up into two segments because the desired hue goes from negative to positive (0 +- 20 degrees). cv.inRange has no logic that would allow you to express that in a single range. Hence two pieces, or-ed together (addition).