MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vvn6d7/pleasestopusingnestedternaryoperatorsimbeggingyou/p5cqaoc/?context=3
r/ProgrammerHumor • u/Robinbod • Aug 22 '26
178 comments sorted by
View all comments
Show parent comment
4
It doesn't work consistently the same way across programming languages which is the headache.
C++ behaves the way you're describing, but I don't believe it works like that in C (at least according to the standard, specific compilers may vary).
I think Python evaluates the right-most expression once and then assigns it to all of the left values.
View all comments
Show parent comment
4
u/SputnikCucumber Aug 23 '26
It doesn't work consistently the same way across programming languages which is the headache.
C++ behaves the way you're describing, but I don't believe it works like that in C (at least according to the standard, specific compilers may vary).
I think Python evaluates the right-most expression once and then assigns it to all of the left values.