Python Forum
getting the value being tested
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
getting the value being tested
#1
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).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
sound like use case for the newest addition in python - assignment expressions and walrus operator in 3.8
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020