4 ms·
so you get the exact same answer? in js, Boolean('' && 0) will give you the same answer as bool('' and 0) in python. if i code golf in python (like the articl
by positron6000 3y ago
so you get the exact same answer?
in js, Boolean('' && 0) will give you the same answer as bool('' and 0) in python.
if i code golf in python (like the article does in js), i'll also get weird-looking code and "unexpected" outputs.
valid python: 0*"string"or"other_string"
- kdmccormick 3y agoSure, I was just responding to the question: > Like, can you tell me a language where it does make sense to "apply AND to an empty string and a (negative?) zero"? People do stuff like that in Python all the time. Personally, I don't do it in JS, though, because I find the conversion-to-bool rules much less predictable. In this case, though, I guess JS would behave the same.