![]() |
one line if else - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html) +--- Forum: Bar (https://python-forum.io/forum-27.html) +--- Thread: one line if else (/thread-15602.html) |
one line if else - Skaperen - Jan-24-2019 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). RE: one line if else - perfringo - Jan-24-2019 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. RE: one line if else - Skaperen - Jan-26-2019 oh, i thought BDFL was the only voter. |