Re: **kwargs?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: **kwargs?

From: Michael Hoffman <cam.ac.uk@mh391.invalid>
Date: Wed Jul 13 2005 - 15:02:35 CEST

Peter Hansen wrote:
> Francois De Serres wrote:
>

>> *args is documented in the Tutorial. I reckon **kwargs represents a
>> dictionary of arguments. But I don't quite get the semantics of **x.
>> Undefined length tuple of undefined length tuples? Are there other
>> practical use cases for ** (common enough please, I wish I was, but
>> I'm not a scientist).
>
> Where did you get "tuples of tuples" for **x ?

I would guess it is confusion from languages where unary * means
dereference and ** means double dereference.

To the OP: I'm glad you have been reading the tutorial. If you have
further questions the reference manual is a good place to look:

http://docs.python.org/ref/function.html

Just as you can use a name other than self as the first argument to an
unbound method, you can call your *args and **kwargs *x and **y instead,
but they will still act just like *args and **kwargs.

The stars are magic, not the names.

-- 
Michael Hoffman
Received on Thu Sep 29 16:55:34 2005