Web Images Videos Maps News Groups Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion *args and **kwargs
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Wildemar Wildenburger  
View profile  
 More options Jun 5 2007, 10:42 pm
Newsgroups: comp.lang.python
From: Wildemar Wildenburger <wilde...@freakmail.de>
Date: Tue, 05 Jun 2007 14:42:04 +0200
Local: Tues, Jun 5 2007 10:42 pm
Subject: Re: *args and **kwargs
JonathanB wrote:
> Ok, this is probably definitely a newbie question, but I have looked
> all over the Python library reference material and tutorials which I
> can find online and I cannot find a clear definition of what these are
> and more importantly how to use them. From what I can tell from their
> use in the examples I've seen, they are for passing a variable number
> of arguments to a function (which I need to do in a program I am
> working on). But how do you use them? Is there a fixed order in which
> the arguments within *arg or **kwarg should be passed or will be
> called within a function? I realize this probably involves a long-
> winded answer to a very simple and common programming problem, so if
> someone has a link to TFM, I'll gladly go RTFM. I just can't find it.

http://www.python.org/doc/faq/programming/#how-can-i-pass-optional-or...
(the first hit when you search python.org for *args and **kwargs)

Basically 'args' is a tuple with all the positional arguments, kwargs is
a dictionary with all the named arguments.
Likewise you can pass a tuple to a function like func(*tuple), or a dict
like func(**dictionary) or both, where the zuple has to come first.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google