On 17 February 2012 07:53, Zheng Li <dllizh...@gmail.com> wrote:
> def method1(a = None):
>        print a
>
> i can call it by
> method1(*(), **{'a' : 1})
>
> I am just curious why it works and how it works?
> and what do *() and **{'a' : 1} mean?
>
> when I type *() in python shell, error below happens
>
>  File "<stdin>", line 1
>    *()
>    ^
> SyntaxError: invalid syntax

It's worth reading the Python tutorial.  Here's the relevant section:

http://docs.python.org/tutorial/controlflow.html#unpacking-argument-lists

You could read all of 4.7

-- 
Arnaud
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to