3 ms·
Actually I think the more common hack was a = cond and x or y which had the downside that if the second part (in this case x) evaluates to False then a en
by EliAndrewC 18y ago
Actually I think the more common hack was
a = cond and x or y
which had the downside that if the second part (in this case x) evaluates to False then a ends up equal to y even through that's not what you were trying to do. Sometimes this is a problem and sometimes not, but it's been irrelevant for the past few years.
- jcausey 18y agoVery true. I've seen that hack before, but I guess I mentally settled on my first example (probably due to the irksome possibility of x=0\False). Unfortunately, there were probably more hacks than our two examples. Thank goodness Guido (etc) settled on a real ternary semantic -- we were heading into Perl more-than-9000-ways-to-do-something territory!