[Python-ideas] Python Users Aren't Perfect
masklinn at masklinn.net
Thu Dec 15 22:05:26 CET 2011
On 2011-12-15, at 21:51 , Antoine Pitrou wrote:
> On Thu, 15 Dec 2011 15:42:42 -0500
> Ned Batchelder <ned at nedbatchelder.com>
>> 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 it inconsistent? Function signatures generally have a fixed (or
> mostly fixed) number of heterogenous arguments.
But *args is mostly dedicated to an arbitrary (non-fixed) number of homogenous arguments. In statically typed languages with varargs, they're generally represented as an array-type collection.
It's either that or a "rest of that crap" catchall used to forward arguments without caring much for what they are.
More information about the Python-ideas