Python Forum

Full Version: getting the value being tested
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
is there any possible way to combine an assignment and an elif test of a value obtained from a function call that is not to be repeated? or is the only way, to abandon doing elifs and do a continue after each of many if tests? fortunately, this is inside a loop, so continue would work. it just makes things a bit harder to read. continue is kinda like doing goto (and i hate those in general).
sound like use case for the newest addition in python - assignment expressions and walrus operator in 3.8