[Python-ideas] Python Users Aren't Perfect

Ned Batchelder ned at nedbatchelder.com
Thu Dec 15 22:54:16 CET 2011


On 12/15/2011 4:24 PM, Ethan Furman wrote:
> Ned Batchelder wrote:
>>   On 12/15/2011 3:59 PM, Tim Delaney wrote:
>>> On 16 December 2011 07:42, 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!  :-(
>>>
>>>
>>> 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.
>>>
>> Tim, this seems misguided to me.  Finish that foo function 
>> definition: it will *have* to have  "for a in args:"   Since I don't 
>> know the length of args when I write the function, I have to treat it 
>> as an unknown length.  What good is a "structure" that changes length 
>> and definition with every instance?  I think you're trying too hard 
>> to fit the reality into the theory.
>
> Python is a dynamic language -- why can't it have dynamic structs?
>
I honestly don't know how to interpret this.  In what way is it a 
"struct" if I have no idea how many fields it has, or how they might 
differ from each other?   I think we've lost the utility of this discussion.

--Ned.
> ~Ethan~
>



More information about the Python-ideas mailing list