While parentheses are redundant, interpreter doesn’t raise a syntax error. However, removing the parentheses does result in a syntax error. This is yet another inconsistency.
This approach functions with the “return” statement.
a = 4
b = 4
def foo():
return ((((a == 4, b == 4))))
print(foo()) # (True, True)
However, let’s stay on track!
I don’t see any reasons against using parentheses to join lines, especially when backslashes are already allowed for global and nonlocal statements.
I understand that. But the Python interpreter can’t reasonably do anything to help you with code that might be erroneous. A linter can warn you.
Assertions take an “expression”, and a parenthesized expression with a comma is a tuple. So you can’t also use it to “join lines” in the way that you mean (combining multiple assertions). Anyway, combining multiple assertions together is just bad.
That said, you can join lines in the usual way with parentheses and assertions: