for bar_vec in bar_mat:
if bar_vec != []:
for y in bar_vec:
if baz(y):
for x in y:
foo(x)
Seeing it written out here, the example looks nice. In real code with more complexity, it takes longer for me to write it, and it usually takes up a lot more space than this. It bugs me how much space it takes up for something that is one idea in my head (Foo all the baz things in bar_vec).
But if there is anyone coming after me, I would write it in this style for their sake, because this style is easier to change.