From: Jonathan Fine on
Hi

We can call a function fn using
val = fn(*args, **kwargs)

I'm looking for a good name for the pair (args, kwargs). Any suggestions?

Here's my use case:
def doit(fn , wibble, expect):
args, kwargs = wibble
actual = fn(*args, **kwargs)
if actual != expect:
# Something has gone wrong.
pass

This is part of a test runner.

For now I'll use argpair, but if anyone has a better idea, I'll use it.

--
Jonathan
From: Tim Chase on
Jonathan Fine wrote:
> We can call a function fn using
> val = fn(*args, **kwargs)
>
> I'm looking for a good name for the pair (args, kwargs). Any suggestions?
>
> For now I'll use argpair, but if anyone has a better idea, I'll use it.

In the legacy of C and Java (okay, that doesn't carry _much_
weight with me), I'd go with "varargs" to refer to the pair of
(args, kwargs)

-tkc



From: Paul Rubin on
Jonathan Fine <J.Fine(a)open.ac.uk> writes:
> I'm looking for a good name for the pair (args, kwargs). Any suggestions?
>
> Here's my use case:
> def doit(fn , wibble, expect):
> args, kwargs = wibble
> actual = fn(*args, **kwargs)

I think this may have been broken in 3.x, but in 2.6 the compiler will
unpack directly if you put a tuple structure in the arg list:

def doit(fn, (args, kwargs), expect):
actual = fn(*args, **kwargs)

Otherwise I'd just say "all_args" or some such. Or just "args" which
you unpack into "pos_args" (positional args) and "kw_args".
From: Steve Holden on
Jonathan Fine wrote:
> Hi
>
> We can call a function fn using
> val = fn(*args, **kwargs)
>
> I'm looking for a good name for the pair (args, kwargs). Any suggestions?
>
> Here's my use case:
> def doit(fn , wibble, expect):
> args, kwargs = wibble
> actual = fn(*args, **kwargs)
> if actual != expect:
> # Something has gone wrong.
> pass
>
> This is part of a test runner.
>
> For now I'll use argpair, but if anyone has a better idea, I'll use it.
>
Not being able to find any existing names I called *args the
sequence-parameter and **kwarg the dict-parameter.

For your use, though, you might choose something like the "generic
parameter pair).

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/

From: Aahz on
In article <mailman.284.1267707023.23598.python-list(a)python.org>,
Tim Chase <python.list(a)tim.thechases.com> wrote:
>Jonathan Fine wrote:
>>
>> We can call a function fn using
>> val = fn(*args, **kwargs)
>>
>> I'm looking for a good name for the pair (args, kwargs). Any suggestions?
>>
>> For now I'll use argpair, but if anyone has a better idea, I'll use it.
>
>In the legacy of C and Java (okay, that doesn't carry _much_ weight
>with me), I'd go with "varargs" to refer to the pair of (args, kwargs)

Ditto
--
Aahz (aahz(a)pythoncraft.com) <*> http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer