Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20540
| References | <B731B4CF-918F-403C-82C3-64E4F5EBC0B2@gmail.com> |
|---|---|
| Date | 2012-02-17 08:00 +0000 |
| Subject | Re: question about function pointer |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5912.1329465657.27778.python-list@python.org> (permalink) |
On 17 February 2012 07:53, Zheng Li <dllizheng@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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: question about function pointer Arnaud Delobelle <arnodel@gmail.com> - 2012-02-17 08:00 +0000
csiph-web