[Python-ideas] Python Users Aren't Perfect
ethan at stoneleaf.us
Thu Dec 15 22:00:03 CET 2011
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."
> Then we define a function foo(*args), and Python gives us a tuple! :-(
Where is that in the docs? Sounds like a patch is needed:
"lists are for sequences where items need to be added/removed; tuples
are for sequences/aggregations where items will not be added/removed
once the tuple is created"
As Antoine noted, a tuple for 'args' is appropriate, as once args is
created at function call time, we won't be adding or removing from it.
More information about the Python-ideas