[Python-ideas] Python Users Aren't Perfect
ned at nedbatchelder.com
Thu Dec 15 22:09:31 CET 2011
On 12/15/2011 3:59 PM, Tim Delaney wrote:
> On 16 December 2011 07:42, Ned Batchelder <ned at nedbatchelder.com
> <mailto:ned at nedbatchelder.com>> 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.
> Tim Delaney
> Python-ideas mailing list
> Python-ideas at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas