In python, one can declare a tuple explicitly with parenthesis as such:
>>> x = (0.25, 0.25, 0.25, 0.25)
>>> x
(0.25, 0.25, 0.25, 0.25)
>>> type(x)
<type 'tuple'>
Alternatively, without parenthesis, python automatically packs its into a immutable tuple:
>>> x = 0.25, 0.25, 0.25, 0.25
>>> x
(0.25, 0.25, 0.25, 0.25)
>>> type(x)
<type 'tuple'>
Is there a pythonic style to declare a tuple? If so, please also reference the relevant PEP or link.
There's no difference in the "end-product" of achieving the tuple but is there a difference in how the tuple with and without parenthesis are initialized (in CPython)?
CPython
– Dialectx = (0.25, 0.25, 0.25, 0.25)
because it's clear thatx
is a tuple. And that's more like a real tuple (I mean, like the output). – Bordereau