On Wed, Dec 16, 2009 at 12:37 PM, Laurent Gautier <lgaut...@gmail.com> wrote:
> On 12/15/09 6:42 PM, Peng Yu wrote:
>>
>> On Wed, Dec 16, 2009 at 10:19 AM, Mark Larsen<larsen...@gmail.com>  wrote:
>>>>
>>>> I don't understand what '*' and '**' mean. Could somebody let me know?
>>>
>>> This is a python thing.  '*' means that any number of arguments can be
>>> passed as a tuple.
>>>
>>> For instance, I have function:
>>>
>>> def add(a,b):
>>>  return a+b
>>>
>>> I could call this with a tuple argument:
>>>
>>> var = (4,5)
>>> add(*var)
>>>
>>> '**' means any number of keyword arguments (dict) could be passed:
>>>
>>> def add(a=1,b=1):
>>>  return a+b
>>>
>>> I could call this with keywords by:
>>>
>>> var = {'a': 4, 'b':5}
>>> add(**var)
>>
>> Are '*' and '**' described somewhere in python's documentation? Would
>> you please let me know where they are? Thank you!
>
> http://docs.python.org/reference/expressions.html#calls
> but Mark told you pretty much everything you should know to follow the
> documentation, I think.

I was afraid that I missed any introductory level python document as I
don't find '*' and '**' in the python tutorial. I guess this is not
beginner level feature, right? Thank you for pointing me the
reference, I'll read more on it.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to