On 20 Mar 2006 15:45:36 -0800 in comp.lang.python,
[EMAIL PROTECTED] (Aahz) wrote:
>In article <[EMAIL PROTECTED]>,
>Dave Hansen <[EMAIL PROTECTED]> wrote:
[...]
>>It's harder to explain than understand. Try playing with the
>>following function in the python interpreter:
>>
>> def test(a,b='b', *c, **d):
>> print a,b,c,d
>
>Personally, I think it's a Good Idea to stick with the semi-standard
>names of *args and **kwargs to make searching easier...
Agreed (though "kwargs" kinda makes my skin crawl). I don't use these
features often in my code, but when I do, I follow the convention. The
example was just for illustrative purposes, and the names chosen for
easy typing.
It is important to note that using "args" and "kwargs" is a convention
rather than a requirement, analogous to "self". You can use different
identifiers, but future maintainers of your code will be annoyed.
But it won't affect the operation of the code. I found the test case
"test(a=1,b=2,c=3,d=4)" to be most edifying.
Regards,
-=Dave
--
Change is inevitable, progress is not.
--
http://mail.python.org/mailman/listinfo/python-list