Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
one line if else
#1
python supports statements like
    foo[x] = bar[a if woot[x] else b]
but i recall some people expressing a dislike for code like that. i'd like to know what the general community opinion on this is. if it's only partially negative, i'd also like to know which cases are disapproved (avoiding the h-word).
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
Some of background information is available in PEP 308 -- Conditional Expressions. Divide in opinion can be deducted from short-circuit behavior chapter and voting results.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#3
oh, i thought BDFL was the only voter.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

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