Python does short circuit evaluation as C does.
This means in the "and" case, that the right side of the and
is only evaluated if the left side effectively is True.
So your code is roughly equivalent to:
x = bar(a, b, c)
if x:
foo = foo
else:
foo = x
return foo
With the distinction of course, that the variable x is not used (since not needed).
The important fact to note here is, that for example if foo was set to "stringval" and bar(a,b,c) returns something that can be interpreted as True, than "stringval" will be returned. So unlike than in some other languages, a boolean expression can have a non-boolean result.