Does the usage of parentheses have any effect whatsoever in the variable declaration syntax of a Python for loop?
Example 1: basic for loop declaring i with no parenthesis
>>> for i in range(0,10): print(i)
...
0
1
2
3
4
5
6
7
8
9
Basic for loop declaring i with arbitrary parentheses
for (((((i))))) in range(0,10): print(i)
...
0
1
2
3
4
5
6
7
8
9
For loop which unpacks two values, declared with no parentheses
>>> for x,y in zip(range(0,10), range(0,10)): print(x,y)
...
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
Same thing, but with parenthesis around x, y, and both.
>>> for ((x),(y)) in zip(range(0,10), range(0,10)): print(x,y)
...
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
So it seems the parentheses have no effect - they are not interpreted as creating, for example, a tuple. Am I correct, or is there any reason to use parentheses in a for loop variable declaration?
You can even, apparently, say this:
>>> for [x,y] in zip(range(0,10), range(0,10)): print(x,y)
...
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
...and the list notation (brackets) appear to have no effect either.
(value,)