Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20540
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <arnodel@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.026 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'python': 0.08; 'none):': 0.09; 'def': 0.13; 'received:209.85.214.174': 0.13; 'subject:function': 0.16; 'syntaxerror:': 0.16; 'tutorial.': 0.16; 'cc:addr:python-list': 0.16; 'syntax': 0.16; 'subject:question': 0.16; 'wrote:': 0.18; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.26; 'invalid': 0.28; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.29; 'error': 0.30; 'curious': 0.34; 'url:python': 0.35; 'received:209.85.214': 0.36; 'received:google.com': 0.37; 'happens': 0.38; 'received:209.85': 0.38; 'could': 0.38; 'url:org': 0.39; 'received:209': 0.39; 'type': 0.61; 'worth': 0.61; 'below': 0.62; 'relevant': 0.71; '4.7': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=wlQVAP4W0BR5N52+HyF8RjaxHbHeiecb8mMSobpgJQY=; b=Lz30Y+RB4Mzofse5+aC2jlBUYa9dbnl5A+yPBFHE58SkRMHm2eu8mf1VdO2s5eXgv0 PzAvnEU7Ujn8RYjk2COkw8/Z32g4OGd28TgbbNJp6Z01Kxhxbg89bIuaMvzCmHvjxxM7 W7aUAp59cIhtYbagXyjGR4EvgH3BU3qlSgfDA= |
| MIME-Version | 1.0 |
| In-Reply-To | <B731B4CF-918F-403C-82C3-64E4F5EBC0B2@gmail.com> |
| References | <B731B4CF-918F-403C-82C3-64E4F5EBC0B2@gmail.com> |
| Date | Fri, 17 Feb 2012 08:00:54 +0000 |
| Subject | Re: question about function pointer |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| To | Zheng Li <dllizheng@gmail.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5912.1329465657.27778.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1329465657 news.xs4all.nl 6883 [2001:888:2000:d::a6]:33527 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:20540 |
Show key headers only | View raw
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