Re:The Python IAQ: Infrequently Answered Questions
by TallGuyShort on Friday November 12, 2010 @08:46AM
(#1897580)
Incidentally, most C-style-syntax languages have a ternary conditional operator, and I use it quite a lot for things like building strings, very small conditionals, etc.... When used correctly, it can improve readability and expressiveness quite a bit.
x = <test> ? <result> : <alternative>
Some times for slightly more complex expressions, I'll put them on separate lines so as to have a very compact if/else structure.
x = <test> ? <result> : <alternative>
Some times for slightly more complex expressions, I'll put them on separate lines so as to have a very compact if/else structure.