Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'guido': 0.05; 'url:pipermail': 0.05; 'subject:query': 0.07; 'string': 0.09; 'comments?': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'lines.': 0.09; 'message-id:@stoneleaf.us': 0.09; '~ethan~': 0.09; 'before.': 0.16; 'emacs,': 0.16; 'enough.': 0.16; 'finney': 0.16; 'literals': 0.16; 'personally,': 0.16; 'url:2009-october': 0.16; 'vim)': 0.16; 'wrote:': 0.18; "python's": 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'subject:Code': 0.24; '(or': 0.24; "i've": 0.25; 'purposes': 0.26; 'subject:/': 0.26; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; 'feature': 0.29; '[1]': 0.29; 'am,': 0.29; '[2]': 0.30; 'code': 0.31; 'comments': 0.31; 'comments,': 0.31; 'writes:': 0.31; '(including': 0.33; 'url:python': 0.33; '(e.g.': 0.33; 'comment': 0.34; "can't": 0.35; 'agree': 0.35; 'editor': 0.35; 'himself': 0.36; 'sequence': 0.36; 'done': 0.36; 'doing': 0.36; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'ben': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'free': 0.61; 'reserved': 0.61; 'received:173': 0.61; 'such': 0.63; 'hey,': 0.75; 'yourself': 0.78; 'treating': 0.84; 'url:python- dev': 0.84 Date: Mon, 31 Mar 2014 17:30:35 -0700 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Code style query: multiple assignments in if/elif tree References: <874n2ecr5x.fsf@elektro.pacujo.net> <85y4zqkmck.fsf@benfinney.id.au> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source-IP: 173.12.184.233 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([173.12.184.233]) [173.12.184.233]:36384 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1396313500 news.xs4all.nl 2837 [2001:888:2000:d::a6]:53187 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69458 On 03/31/2014 04:12 PM, Chris Angelico wrote: > On Tue, Apr 1, 2014 at 9:57 AM, Ben Finney wrote: >> Chris Angelico 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. Personally, I use the sequence of one-line comments. But, hey, Guido [1] himself likes the triple-quoted string as comment feature [2], so feel free to use it yourself if you like. -- ~Ethan~ [1] https://mail.python.org/pipermail/python-dev/2013-March/124947.html [2] https://mail.python.org/pipermail/python-ideas/2009-October/006204.html