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

Devin Jeanpierre jeanpierreda at gmail.com
Sun Aug 17 13:44:31 CEST 2014


On Sun, Aug 17, 2014 at 1:23 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
> I have encountered many uses of “homogeneous, variable-length sequence”
> and every time a Python tuple is used for that, I perceive a Python list
> would be better precisely *because* it better indicates that semantic
> meaning.
>
> I'd like to know how you think that's not true, and what real-world code
> makes you think so.

isinstance is real world code that for the second parameter accepts
types and (recursively) tuples of any length of things it accepts.

It doesn't accept lists, because then it would need to check for cycles.

-- Devin


More information about the Python-ideas mailing list