Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20540 > unrolled thread
| Started by | Arnaud Delobelle <arnodel@gmail.com> |
|---|---|
| First post | 2012-02-17 08:00 +0000 |
| Last post | 2012-02-17 08:00 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: question about function pointer Arnaud Delobelle <arnodel@gmail.com> - 2012-02-17 08:00 +0000
| From | Arnaud Delobelle <arnodel@gmail.com> |
|---|---|
| Date | 2012-02-17 08:00 +0000 |
| Subject | Re: question about function pointer |
| Message-ID | <mailman.5912.1329465657.27778.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web