[Python-ideas] Python Users Aren't Perfect

Ned Batchelder ned at nedbatchelder.com
Fri Dec 16 03:56:27 CET 2011

On 12/15/2011 8:39 PM, Guido van Rossum wrote:
> On Thu, Dec 15, 2011 at 5:16 PM, Terry Reedy <tjreedy at udel.edu 
> <mailto:tjreedy at udel.edu>> wrote:
>     On 12/15/2011 3:42 PM, Ned Batchelder wrote:
>         This is another place where Python is inconsistent. We're
>         told, "lists
>         are for homogenous sequences of varying length, like a C
>         array; tuples
>         are for heterogenous aggregations of known length, like a C
>         struct."
>     I have not been told that for several years, and I am pretty sure
>     you will not find any such thing in the current docs. I consider
>     it pretty much obsolete, as the differences that flowed from that
>     idea are gone. In Python 3, tuples have all the non-mutating
>     sequence methods that list does. The situation was much different
>     in 1.4.
> I strongly disagree. Being immutable sequences (i.e. homogeneous) is a 
> minor secondary role for tuples. Their primary role remains to hold a 
> small bunch of heterogeneous values -- like namedtuple, but without 
> needing forethought. A good example are dictionary items -- these are 
> (key, value) pairs where for a given dict, the keys are all of the 
> same type (or of a small set of related types) and ditto for the 
> values, but the key type and the value types are unrelated.
Could you explain why the foo(*args) syntax creates args as a tuple 
rather than a list?

> -- 
> --Guido van Rossum (python.org/~guido <http://python.org/%7Eguido>)
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20111215/3a637a32/attachment.html>

More information about the Python-ideas mailing list