It's extremely easy to check, with the dis
module:
>>> import dis
>>> dis.dis(compile('a,b,c=1,2,3','','exec'))
1 0 LOAD_CONST 4 ((1, 2, 3))
3 UNPACK_SEQUENCE 3
6 STORE_NAME 0 (a)
9 STORE_NAME 1 (b)
12 STORE_NAME 2 (c)
15 LOAD_CONST 3 (None)
18 RETURN_VALUE
>>> dis.dis(compile('(a,b,c)=(1,2,3)','','exec'))
1 0 LOAD_CONST 4 ((1, 2, 3))
3 UNPACK_SEQUENCE 3
6 STORE_NAME 0 (a)
9 STORE_NAME 1 (b)
12 STORE_NAME 2 (c)
15 LOAD_CONST 3 (None)
18 RETURN_VALUE
>>>
See? Those totally redundant parentheses make absolutely no difference to the bytecode that's generated and executed -- just like, say, a+b
and (a+b)
will generate and execute exactly the same bytecode as each other. So, if you like to add redundant parentheses, knock yourself out -- people reading your code may not like them, but ones who are just executing it will never even notice. Only, why stop at just two pairs of redundant parentheses? See,
>>> dis.dis(compile('(((a,b,c)))=(((1,2,3)))','','exec'))
1 0 LOAD_CONST 4 ((1, 2, 3))
3 UNPACK_SEQUENCE 3
6 STORE_NAME 0 (a)
9 STORE_NAME 1 (b)
12 STORE_NAME 2 (c)
15 LOAD_CONST 3 (None)
18 RETURN_VALUE
>>>
six pairs of redundant parentheses (or any number, really) still produce exactly the same code. Once you leave the obvious minimum number of redundant parentheses (none at all: they're redundant, after all;-), exactly where do you stop?-) And why there, when it's "free" to add yet one more pair... or two... or three...?-)