Path: csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '+++': 0.03; 'skip:[ 20': 0.03; 'diff': 0.05; 'executable': 0.07; 'ast': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'thx': 0.09; 'tuple': 0.09; 'example:': 0.10; 'def': 0.13; '+1,11': 0.16; '-1,9': 0.16; 'comma': 0.16; 'comma,': 0.16; 'executables': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'wrote:': 0.16; 'element': 0.18; '>>>': 0.20; '+0200': 0.20; 'setup,': 0.22; 'import': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'function': 0.28; '---': 0.28; 'cat': 0.29; 'program,': 0.29; 'add': 0.34; 'there': 0.36; 'smaller': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'no,': 0.38; 'version': 0.38; 'end': 0.39; 'why': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'hello,': 0.40; 'vous': 0.61; 'dont': 0.64; 'dans': 0.72; 'skip:n 40': 0.72; 'subject:location': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: Strange location for a comma Date: Thu, 03 Sep 2015 14:48:03 +0200 Organization: None References: <55e83afb$0$3157$426a74cc@news.free.fr> <55e83ce3$0$3327$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Gmane-NNTP-Posting-Host: p57bd91c6.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 93 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441284505 news.xs4all.nl 23828 [2001:888:2000:d::a6]:39427 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95927 ast wrote: > > "ast" a écrit dans le message de > news:55e83afb$0$3157$426a74cc@news.free.fr... >> Hello, >> At the end of the last line of the following program, >> there is a comma, I dont understand why ? >> >> Thx >> >> >> from cx_Freeze import setup, Executable >> >> # On appelle la fonction setup >> setup( >> name = "salut", >> version = "0.1", >> description = "Ce programme vous dit bonjour", >> executables = [Executable("salut.py")], # <--- HERE >> ) >> >> > > Ok its understood, it's a 1 element only tuple > > example: > >>>> A = 5, >>>> A > (5,) > >>>> A = (6) >>>> A > 6 > No, in a function call an extra comma has no effect: >>> def f(x): return x ... >>> f(42) 42 >>> f(42,) 42 >>> f(x=42) 42 >>> f(x=42,) 42 The only reason I see to add an extra comma are smaller and easier to read diffs when you make a change: $ cat before.py func( arg_one=1, arg_two=2 ) func( arg_one=1, arg_two=2, ) $ cat after.py func( arg_one=1, arg_two=2, arg_three=3 ) func( arg_one=1, arg_two=2, arg_three=3, ) $ diff -u before.py after.py --- before.py 2015-09-03 14:44:27.709735075 +0200 +++ after.py 2015-09-03 14:44:55.275958331 +0200 @@ -1,9 +1,11 @@ func( arg_one=1, - arg_two=2 + arg_two=2, + arg_three=3 ) func( arg_one=1, arg_two=2, + arg_three=3, )