On 16 December 2011 07:42, Ned Batchelder firstname.lastname@example.org 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! :-(
How is that inconsistent? At the point where the tuple is constructed, it has a known length. And it's definitely a heterogenous aggregation.
I think where you're getting confused is that you're thinking of a *single* struct definition for every tuple. But the concept you should have is that each tuple has its own struct definition. And with functions, the structure is defined at function call time.