Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53606
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <vlastimil.brom@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'subject:not': 0.03; 'string.': 0.05; 'string': 0.09; 'converts': 0.09; 'python': 0.11; 'adjacent': 0.16; 'false:': 0.16; 'literals': 0.16; 'quotes)': 0.16; 'subject:comment': 0.16; 'subject:python': 0.16; '>>>': 0.22; 'example': 0.22; 'print': 0.22; 'regardless': 0.24; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'skip:p 30': 0.29; 'respective': 0.29; 'message- id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; '(which': 0.31; 'code': 0.31; "skip:' 10": 0.31; 'comments,': 0.31; 'implicit': 0.31; 'multiline': 0.31; 'url:python': 0.33; 'comment': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'accessible': 0.36; 'i.e.': 0.36; 'joined': 0.36; 'url:listinfo': 0.36; 'subject:?': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'sometimes': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=sWar7Tr/mWXRc9dbDBsv1Gesh1Chipi3bZ5gG++9KmY=; b=CJqkZEw44cg/zDJM9Vr09rC9wqQalukHrxGFBvb+0fkEM8mh+r3ZOAJkZqOR/Kmg9P e/R2jk3ju9WiegooxwupnzWICw0oVV5RqFBl9Z5U3HK9A5WzsgHXDdLcSgnQDlX121Tp XkE/Tj++0wsPCRLBpX06CqAYTmWdAGPByLVCU32KCidhgXVCXXMAIauFLhFF0vaMEJCL NlJhlhEj4xXeW1DLMkD5TPk30eZXcFx5mr/9M2Bwz+xYUa9YV/F4Hx1uXJzo45+b743T izs6pAUJ4cPqNGJomA4fDwnX1hn+wvQUbuFQMwIJ+RnaivEXa9YXbQ2odok/df3Nqq+b a+qA== |
| MIME-Version | 1.0 |
| X-Received | by 10.182.61.44 with SMTP id m12mr1155772obr.52.1378281319244; Wed, 04 Sep 2013 00:55:19 -0700 (PDT) |
| In-Reply-To | <551579b9-951e-4f46-bb10-488d39eac6a7@googlegroups.com> |
| References | <551579b9-951e-4f46-bb10-488d39eac6a7@googlegroups.com> |
| Date | Wed, 4 Sep 2013 09:55:19 +0200 |
| Subject | Re: how does not work nested comment in python? |
| From | Vlastimil Brom <vlastimil.brom@gmail.com> |
| To | python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.32.1378281321.5461.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1378281321 news.xs4all.nl 16005 [2001:888:2000:d::a6]:42742 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:53606 |
Show key headers only | View raw
2013/9/4 <vnkumbhani@gmail.com>:
> example:
>
> print "hello" # print comment +"world" => single line comment
> print "hello" '''print comment''' +"world" => multiple line comment
> --
> https://mail.python.org/mailman/listinfo/python-list
Hi,
python only has single line comments, which apply from a "#" to the
end of the respective line.
There are some possibilities/workarounds/hacks for "commenting out",
i.e. (temporarily) disabling, parts of the code
if False:
<indented original code>
Sometimes triple-quoted multiline strings are (mis)used this way
"""<original code
in multiple
lines>"""
which actually converts the code to a not accessible multiline string.
However, triple quoting is not an official means for multiline comments.
What you are seeing in your second example is implicit string
concatenation (which works regardless of the type of the quotes) -
adjacent string literals in the code are joined automatically:
>>> "abc" 'def' """ghi""" '''jkl'''
'abcdefghijkl'
>>>
hth,
vbr
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how does not work nested comment in python? vnkumbhani@gmail.com - 2013-09-03 23:13 -0700 Re: how does not work nested comment in python? Vlastimil Brom <vlastimil.brom@gmail.com> - 2013-09-04 09:55 +0200 Re: how does not work nested comment in python? Dave Angel <davea@davea.name> - 2013-09-04 12:08 +0000
csiph-web