[Python-ideas] Variable-length, homogeneous tuple: why?

Jukka Lehtosalo jlehtosalo at gmail.com
Mon Aug 18 08:29:01 CEST 2014


On Sun, Aug 17, 2014 at 11:19 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>
wrote:

> Andrew Barnert wrote:
>
>> First, that's how the current typing.py interprets it: Tuple[str] is a
>> homogeneous, arbitrary-length (although of course unchanging, because it's
>> immutable) tuple of strings.
>>
>
> So how do you spell a heterogeneous tuple of length 1
> containing a string?
>

Tuple[str] :-)

The only arbitrary-length tuple that mypy knows about is just 'tuple' and
it isn't generic or necessarily homogeneous (it's dynamically typed,
basically a catch-all for a completely arbitrary tuple). However,
arbitrary-length, homogeneous tuples would be a nice addition, once we
figure out how the type should be named.

Jukka


>
> --
> Greg
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140817/64ac7f0d/attachment-0001.html>


More information about the Python-ideas mailing list