[Python-ideas] Python Users Aren't Perfect
Ben Finney
ben+python at benfinney.id.au
Fri Dec 16 10:08:17 CET 2011
Ned Batchelder <ned at nedbatchelder.com>
writes:
> On 12/15/2011 9:23 PM, Ben Finney wrote:
> > the positional arguments to the function are *not* a homogeneous
> > sequence, so a list doesn't connote the right thing. The position is
> > important – we call them “positional arguments” – so a tuple makes
> > sense.
> In general the positional arguments to a function are not homogenous,
> but the foo(*args) syntax is for precisely when you don't know how
> many args you will get
It's valuable for the case where the arguments need to be passed
verbatim to a superclass. At some point, something in the call chain
should know the meaning of each positional argument.
> and you will of necessity treat them homogenously, no?
If the function consumes the positional arguments as a homogeneous list,
I'd say that's a poor design (the function should instead specify a
single argument which is a homogeneous sequence).
--
\ “If you define cowardice as running away at the first sign of |
`\ danger, screaming and tripping and begging for mercy, then yes, |
_o__) Mr. Brave man, I guess I'm a coward.” —Jack Handey |
Ben Finney
More information about the Python-ideas
mailing list