How I eventually resolve this kind of problems.
minimum = +Inf
for b in bar.naz():
if not some_filter(b):
continue
b = some_op(b)
minimum = min(minimum, b)
foo(minimum)
Yes, plain old procedural python. data flow from top to bottom.
it allows `print` debugging, very usefull to debug some_filter and some_op are broken.