Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion *args and **kwargs

View parsed - Show only message text

Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!newsfeed.freenet.de!feeder.news-service.com!newsgate.cistron.nl!xs4all!transit1.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path: <wilde...@freakmail.de>
X-Original-To: python-l...@python.org
Delivered-To: python-l...@bag.python.org
X-Spam-Status: OK 0.007
Date: Tue, 05 Jun 2007 14:42:04 +0200
From: Wildemar Wildenburger <wilde...@freakmail.de>
User-Agent: Thunderbird 1.5.0.12 (X11/20070530)
MIME-Version: 1.0
To: python-l...@python.org
Subject: Re: *args and **kwargs
References: <1181046478.824231.117300@q75g2000hsh.googlegroups.com>
In-Reply-To: <1181046478.824231.117300@q75g2000hsh.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-BeenThere: python-l...@python.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: General discussion list for the Python programming language
	<python-list.python.org>
List-Unsubscribe: <http://mail.python.org/mailman/listinfo/python-list>,
	<mailto:python-list-requ...@python.org?subject=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/python-list>
List-Post: <mailto:python-l...@python.org>
List-Help: <mailto:python-list-requ...@python.org?subject=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-list>,
	<mailto:python-list-requ...@python.org?subject=subscribe>
Newsgroups: comp.lang.python
Message-ID: <mailman.8719.1181047330.32031.python-list@python.org>
Lines: 21
NNTP-Posting-Host: 194.109.207.14
X-Trace: 1181047330 news.xs4all.nl 322 [::ffff:194.109.207.14]:59642
X-Complaints-To: abuse@xs4all.nl

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-keyword-parameters-from-one-function-to-another
(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.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google