3 ms·
print(type("foo") + "foo") Syntactically correct. Will provoke error during runtime due to invalid semantics.
by xaedes 9y ago
print(type("foo") + "foo")
Syntactically correct. Will provoke error during runtime due to invalid semantics.
- cjbillington 9y agoThat's a TypeError though, not undefined behaviour. People are talking about different things.
- xaedes 9y agoTrue. But I was answering this specific to the question of "syntactically valid yet semantically invalid statements" in python.