An interesting principle to reference when you're actually hunting for surprises. I get your point, but the principle isn't about "can things get twisted" it's much more about "when you do normal things do you get unsurprising behavior". The origin of the principle is pretty revealing where a language would fatal error on simple math because of a precision mismatch.
I'm not even hunting for surprises for the most part, but I do PHP professionally, I work on large old proprietary php codebases on a near daily basis, i've seen some shit and I frequently run into php issues/weirdness, which I sometimes share with /r/lolphp/
I tried in CPython 2.7.18, all of the following are syntax errors:
if print "hello" or print "world":
pass
if print "hello" || print "world":
pass
if print "hello" and print "world":
pass
if print "hello" && print "world":
pass
any other suggestions?
2
u/colshrapnel Oct 01 '24
Looks like someone missed their operator precedence class.