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

Ryan Hiebert ryan at ryanhiebert.com
Mon Aug 18 03:25:35 CEST 2014


> On Aug 17, 2014, at 7:30 PM, Guido van Rossum <guido at python.org> wrote:
> 
> I do agree that frozentuple sounds odd, but perhaps we just need to get used to it.

I’d expect that most uses of Tuple[int] to mean an arbitrary length tuple of integers would be better served with Sequence[int] anyway, so I’d definitely find it odd for Tuple[int] to mean anything other than a tuple with exactly one integer in it.

I could imagine somebody wanting to say that it could be a Sequence but NOT a MutableSequence. Perhaps that could be spelled:

Sequence[int] - MutableSequence[int]

and/or

(Sequence - MutableSequence)[int]


More information about the Python-ideas mailing list