ast wrote: > > "ast" <nom...@invalid.com> a écrit dans le message de > news:55e83afb$0$3157$426a7...@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, ) -- https://mail.python.org/mailman/listinfo/python-list