Comment on The Python IAQ: Infrequently Answered QuestionsparentComments−adambyrtek15yIt's worth noting that Peter himself mentions that most of the ternary tricks he describes are not very readable and wouldn't be considered Pythonic. Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Personally I'd hate to see something like that in any real-world project. (test and [result] or [alternative])[0]−cema15yDepending on the language, it could be an idiom.
Comments
It's worth noting that Peter himself mentions that most of the ternary tricks he describes are not very readable and wouldn't be considered Pythonic.
Personally I'd hate to see something like that in any real-world project.Depending on the language, it could be an idiom.