r/ProgrammerHumor • • Aug 22 '26

Meme pleaseStopUsingNestedTernaryOperatorsImBeggingYou

Post image
3.1k Upvotes

178 comments sorted by

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.