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: 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: References: Date: Fri, 17 Feb 2012 08:00:54 +0000 Subject: Re: question about function pointer From: Arnaud Delobelle To: Zheng Li Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: python-list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On 17 February 2012 07:53, Zheng Li wrote: > def method1(a =3D None): > =C2=A0 =C2=A0 =C2=A0 =C2=A0print 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 > > =C2=A0File "", line 1 > =C2=A0 =C2=A0*() > =C2=A0 =C2=A0^ > 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 --=20 Arnaud