[Python-ideas] Variable-length, homogeneous tuple: why? (was: Optional static typing -- the crossroads)

Alexander Belopolsky alexander.belopolsky at gmail.com
Mon Aug 18 07:02:36 CEST 2014



> On Aug 17, 2014, at 8:30 PM, Guido van Rossum <guido at python.org> wrote:
> 
> Plus, I expect both pedants and ignoramuses may wonder about the empty tuple. :-) I think it deserves a proper name, not magic syntax.

I agree, even though covering all cases in a consistent syntax does not seem hard:

Tuple[int] - variable length homogeneous tuple.
Tuple[int,float] - length 2
Tuple[int,] - length 1
Tuple[()] - length 0

Since length 1 and more so length 0 cases don't seem to get much use, a somewhat non-obvious syntax should be fine. 


More information about the Python-ideas mailing list