Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95928
| Path | csiph.com!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| 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; 'skip:[ 20': 0.03; 'lines,': 0.05; 'executable': 0.07; 'trailing': 0.07; '(1,': 0.09; '[1,': 0.09; 'ast': 0.09; 'that).': 0.09; 'thx': 0.09; 'tuple': 0.09; 'example:': 0.10; 'argument': 0.15; 'comma': 0.16; 'comma,': 0.16; 'executables': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'removed,': 0.16; 'tuple,': 0.16; 'wrote:': 0.16; 'element': 0.18; '>>>': 0.20; 'setup,': 0.22; 'simpler': 0.22; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'separate': 0.27; 'program,': 0.29; 'previous': 0.34; 'add': 0.34; 'list': 0.34; 'there': 0.36; 'lines': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'no,': 0.38; 'version': 0.38; 'end': 0.39; 'why': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'hello,': 0.40; 'your': 0.60; 'vous': 0.61; 'dont': 0.64; 'dans': 0.72; 'skip:n 40': 0.72; 'subject:location': 0.84 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=CvRCCSMD c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=EBOSESyhAAAA:8 a=IkcTkHD0fZMA:10 a=uWO-OpwPAAAA:8 a=1bOgCBVwkuyfGnQmEHgA:9 a=QEXdDO2ut3YA:10 |
| X-AUTH | mrabarnett@:2500 |
| Subject | Re: Strange location for a comma |
| To | python-list@python.org |
| References | <55e83afb$0$3157$426a74cc@news.free.fr> <55e83ce3$0$3327$426a74cc@news.free.fr> |
| From | MRAB <python@mrabarnett.plus.com> |
| Date | Thu, 3 Sep 2015 13:50:41 +0100 |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
| MIME-Version | 1.0 |
| In-Reply-To | <55e83ce3$0$3327$426a74cc@news.free.fr> |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.62.1441284649.8327.python-list@python.org> (permalink) |
| Lines | 56 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1441284649 news.xs4all.nl 23758 [2001:888:2000:d::a6]:42131 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:95928 |
Show key headers only | View raw
On 2015-09-03 13:28, ast wrote:
>
> "ast" <nomail@invalid.com> 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, it's not a tuple, because it's part of the argument list of 'setup'.
A trailing comma is allowed in argument lists, tuples, lists, etc.
>>> (1, 2, )
(1, 2)
>>> [1, 2, ]
[1, 2]
>>> {1, 2, }
{1, 2}
>>> print(1, 2, )
1 2
>>> {'1': 'one', '2': 'two', }
{'2': 'two', '1': 'one'}
It's nice to be able to do that because if you write the items on
separate lines, like in your example, it's simpler when editing: all of
the lines can end with a comma; if you add a new line, you don't also
have to add a comma to the end of the previous line (a new line is
added, and that's that); when removing a line, you don't also have to
remove the comma from the end of the previous line (an old line is
removed, and that's that).
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Strange location for a comma "ast" <nomail@invalid.com> - 2015-09-03 14:20 +0200
Re: Strange location for a comma "ast" <nomail@invalid.com> - 2015-09-03 14:28 +0200
Re: Strange location for a comma Peter Otten <__peter__@web.de> - 2015-09-03 14:48 +0200
Re: Strange location for a comma MRAB <python@mrabarnett.plus.com> - 2015-09-03 13:50 +0100
Fwd: Strange location for a comma Vladimir Ignatov <kmisoft@gmail.com> - 2015-09-03 08:50 -0400
Re: Strange location for a comma Tim Chase <python.list@tim.thechases.com> - 2015-09-03 09:36 -0500
Re: Strange location for a comma Martin Komoň <martin@mkomon.cz> - 2015-09-03 14:34 +0200
Re: Strange location for a comma Laura Creighton <lac@openend.se> - 2015-09-03 14:40 +0200
Re: Strange location for a comma "ast" <nomail@invalid.com> - 2015-09-03 15:01 +0200
Re: Strange location for a comma Laura Creighton <lac@openend.se> - 2015-09-03 15:02 +0200
Re: Strange location for a comma "Sven R. Kunze" <srkunze@mail.de> - 2015-09-04 01:01 +0200
csiph-web