Why is a double semicolon a SyntaxError in Python?
From the Python grammar, we can see that ; is not defined as \n. The parser expects another statement after a ;, except if there’s a newline after it: Semicolon w/ statement Maybe a semicolon Newline \/ \/ \/ \/ simple_stmt: small_stmt (‘;’ small_stmt)* [‘;’] NEWLINE That’s why x=42;; doesn’t work; because there isn’t a … Read more