Just out of curiosity. I wonder if it is possible to make multiple assignments with the ternary operator in Python. I was thinking of something like this
rval = m if (fl*fm) < 0 else lval = m
On the other hand I wonder why it is not possible to write the code as above. Why wouldn't one implement the Syntax this way? (Sorry if this question is too meta)
EDIT:
to clarify. I was just wrting some bisection function https://en.wikipedia.org/wiki/Bisection_method:
while(n_iterations < n_iters_max):
m = (lival + rival)/2.0
fm = f(m)
if (fl*fm) < 0:
rival = m
else:
lival = m
if np.abs(rival-lival) < ival_size:
break
n_iterations+=1
Thanks for any ideas!