Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #69454

Re: Code style query: multiple assignments in if/elif tree

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:query': 0.07; 'string': 0.09; 'comments?': 0.09; 'lines.': 0.09; 'cc:addr :python-list': 0.11; 'before.': 0.16; 'emacs,': 0.16; 'enough.': 0.16; 'finney': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'literals': 0.16; 'vim)': 0.16; 'wrote:': 0.18; "python's": 0.19; 'cc:addr:python.org': 0.22; 'subject:Code': 0.24; '(or': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'purposes': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'comments': 0.31; 'comments,': 0.31; 'writes:': 0.31; '(including': 0.33; '(e.g.': 0.33; 'comment': 0.34; "can't": 0.35; 'agree': 0.35; 'editor': 0.35; 'received:google.com': 0.35; 'sequence': 0.36; 'done': 0.36; 'doing': 0.36; 'ben': 0.38; 'how': 0.40; 'reserved': 0.61; 'such': 0.63; 'treating': 0.84; 'to:none': 0.92
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:cc :content-type; bh=oIPsF6yRIkVxRrsNz3EJDpziWMw28YuBApqSQBgQFWE=; b=WNJcUccA3Oe3rKn8H9+vo9bkKaQPekibo70IiOlUZHAkK+lxFcMrpV82FFRtT9W6Qi PXF5uqIbjgYXZQTIQNE5v4dyy++zpzrt82ZbfB9VIbs3BFphR531+0tWJUBDY3gDPVYG thP+JqPnli6f1kfX/SSHeSAUbzbtJ6itP7EGkRxpcJJBjTgy50hfrHKjzrY9/tHyMGdo udU0P42IEVTro9a6ynTg4TG+Bs+jSCpFnUWXJJrvhcNP/Tp00vBxGvUcRlqqguQK3k07 SdSJNFITtkRDda1qtqWygZuExHmthG4so2090Sj72Nb5RQPes0hYjZqZgx0ufKcwAErG 4xnA==
MIME-Version 1.0
X-Received by 10.68.112.164 with SMTP id ir4mr33159pbb.153.1396307558865; Mon, 31 Mar 2014 16:12:38 -0700 (PDT)
In-Reply-To <85y4zqkmck.fsf@benfinney.id.au>
References <mailman.8744.1396276875.18130.python-list@python.org> <874n2ecr5x.fsf@elektro.pacujo.net> <CAPTjJmqTTs4FT_X-bQHTpvnnYNm8ojuFBRGkoTNx62CRBHM4rQ@mail.gmail.com> <lhcnga$dd5$1@ger.gmane.org> <CAPTjJmrm9+49hvsk41ijhsOiZgCEumjD=g9HgxkutK3Of8YkRw@mail.gmail.com> <85y4zqkmck.fsf@benfinney.id.au>
Date Tue, 1 Apr 2014 10:12:38 +1100
Subject Re: Code style query: multiple assignments in if/elif tree
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.8759.1396307562.18130.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1396307562 news.xs4all.nl 2933 [2001:888:2000:d::a6]:60598
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:69454

Show key headers only | View raw


On Tue, Apr 1, 2014 at 9:57 AM, Ben Finney <ben+python@benfinney.id.au> wrote:
> Chris Angelico <rosuav@gmail.com> writes:
>
>> How do you go about doing multi-line comments? I know I've seen other
>> code using triple-quoted strings for long comments before.
>
> Just use a sequence of one-line comments::
>
>     # Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a
>     # sapien tempor, suscipit orci sed, elementum nisl. Suspendisse at
>     # lacus ut diam dignissim lobortis ac vitae augue.
>     #
>     # Phasellus bibendum neque a justo vulputate, quis accumsan quam
>     # egestas. Etiam aliquet blandit ante sit amet cursus.
>
> A decent code editor (e.g. Emacs, Vim) will allow manipulation of
> a sequence of one-line comments in Python's comment style, and allow
> treating it as a paragraphs for purposes such as re-wrapping the lines.
>
> I agree with others that triple-quoted strings are best reserved for
> string literals (including docstrings), not comments.

Fair enough. I can't remember where (or when!) it was that I learned
triple-quoted strings were appropriately abused as comments, so I've
just done a quick re-layout into hash comments.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 01:33 +1100
  Re: Code style query: multiple assignments in if/elif tree Marko Rauhamaa <marko@pacujo.net> - 2014-03-31 18:40 +0300
    Re: Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 03:03 +1100
      Re: Code style query: multiple assignments in if/elif tree Rustom Mody <rustompmody@gmail.com> - 2014-03-31 09:20 -0700
        Re: Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 03:29 +1100
          Re: Code style query: multiple assignments in if/elif tree "Rhodri James" <rhodri@wildebst.org.uk> - 2014-03-31 21:31 +0100
    Re: Code style query: multiple assignments in if/elif tree Ned Batchelder <ned@nedbatchelder.com> - 2014-03-31 17:42 -0400
    Re: Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 09:50 +1100
    Re: Code style query: multiple assignments in if/elif tree Ben Finney <ben+python@benfinney.id.au> - 2014-04-01 09:57 +1100
    Re: Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 10:12 +1100
      Re: Code style query: multiple assignments in if/elif tree Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-04-01 00:57 +0000
    Re: Code style query: multiple assignments in if/elif tree Ethan Furman <ethan@stoneleaf.us> - 2014-03-31 17:30 -0700
  Re: Code style query: multiple assignments in if/elif tree Steven D'Aprano <steve@pearwood.info> - 2014-04-01 04:26 +0000
    Re: Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 16:01 +1100
      Re: Code style query: multiple assignments in if/elif tree Steven D'Aprano <steve@pearwood.info> - 2014-04-01 07:20 +0000
        Re: Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 18:35 +1100
          Re: Code style query: multiple assignments in if/elif tree Steven D'Aprano <steve@pearwood.info> - 2014-04-01 08:07 +0000
            Re: Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 19:12 +1100
        Re: Code style query: multiple assignments in if/elif tree Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-01 02:18 -0600
        Re: Code style query: multiple assignments in if/elif tree Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-01 02:24 -0600
    Re: Code style query: multiple assignments in if/elif tree Rustom Mody <rustompmody@gmail.com> - 2014-03-31 22:45 -0700
      Re: Code style query: multiple assignments in if/elif tree David Hutto <dwightdhutto@gmail.com> - 2014-04-01 02:05 -0400
      Re: Code style query: multiple assignments in if/elif tree Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-01 00:28 -0600
    Re: Code style query: multiple assignments in if/elif tree Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-01 00:13 -0600
    Re: Code style query: multiple assignments in if/elif tree David Hutto <dwightdhutto@gmail.com> - 2014-04-01 02:24 -0400
    Re: Code style query: multiple assignments in if/elif tree Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-01 00:39 -0600
    Re: Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 17:55 +1100
      Re: Code style query: multiple assignments in if/elif tree Steven D'Aprano <steve@pearwood.info> - 2014-04-01 07:29 +0000
        Re: Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 18:49 +1100
        Re: Code style query: multiple assignments in if/elif tree Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-01 02:29 -0600
        Re: Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 19:56 +1100
    Re: Code style query: multiple assignments in if/elif tree David Hutto <dwightdhutto@gmail.com> - 2014-04-01 03:21 -0400
    Re: Code style query: multiple assignments in if/elif tree Chris Angelico <rosuav@gmail.com> - 2014-04-01 18:26 +1100
    Re: Code style query: multiple assignments in if/elif tree David Hutto <dwightdhutto@gmail.com> - 2014-04-01 03:34 -0400
    Re: Code style query: multiple assignments in if/elif tree David Hutto <dwightdhutto@gmail.com> - 2014-04-01 03:39 -0400
    Re: Code style query: multiple assignments in if/elif tree David Hutto <dwightdhutto@gmail.com> - 2014-04-01 03:46 -0400
    Re: Code style query: multiple assignments in if/elif tree Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-01 02:55 -0600

csiph-web