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

Chris Angelico rosuav at gmail.com
Mon Aug 18 01:40:53 CEST 2014


On Mon, Aug 18, 2014 at 9:35 AM, Łukasz Langa <lukasz at langa.pl> wrote:
> That being said, we will need support for homogenous tuples, too, simply
> because they are already in the wild. I proposed tuple[int, ...], which is
> explicit and obvious (if you're Polish, that is).

Conceptually, these kinds of constructs are sometimes called
frozenlists. Why not actually create that type?

frozenlist = tuple;

Et voila. Now just define that frozenlist[int] is like list[int]
rather than like tuple[int], and there you are, out of your difficulty
at once!

ChrisA


More information about the Python-ideas mailing list