4 ms·
Don't think so, Python doesn't really care if you dispose of the results of an expression. Think about the problems you'd have with ternaries.
by mark-r 6y ago
Don't think so, Python doesn't really care if you dispose of the results of an expression. Think about the problems you'd have with ternaries.
- owl57 6y agoWhat's the problem with ternaries?
- dragonwriter 6y agoTernaries don't discard results that are generated, they are just special short-circuiting operators; x if y else z Is effectively syntax sugar for: y and x or z Nothing is discarded after evaluation, one of three arms is never evaluated, just as one of two arms of a common short-circuiting Boolean operator often (but not always) is not. That's essentially the opposite of executing and producing possible side effects and then discarding the results.