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


Groups > comp.lang.python > #12252

how to format long if conditions

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <arnodel@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.054
X-Spam-Evidence '*H*': 0.89; '*S*': 0.00; 'else:': 0.03; 'received:209.85.160.174': 0.09; 'received:mail- gy0-f174.google.com': 0.09; 'formatting': 0.23; 'code': 0.25; "i'm": 0.27; 'all,': 0.28; 'message-id:@mail.gmail.com': 0.29; 'example': 0.30; 'subject:format': 0.30; 'to:addr:python-list': 0.33; 'wondering': 0.33; "i've": 0.34; 'do?': 0.34; 'received:209.85.160': 0.35; 'statements': 0.37; 'something': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'to:addr:python.org': 0.39; 'right)': 0.84; 'subject:long': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=BaxVHtqMMyQHkY5yOjfsqt5y3Qt6wBSgOhJRNY5CB1s=; b=uu25Q0V2xpMBYyGqmws0E9aDlWYhvHY9BQVD2v3797Iw7vn0YwTWZy2LiMY3lFDr4t Fs7f5s16sEnpj9v6/CHccgJX132m+9CVc0eRfR2ZUGFvAP9sdL8mPL/s34WanDb04ipU NlxpCjgQYTsk00ZNX6cEGAAGUZoc4n7o8YHts=
MIME-Version 1.0
Date Sat, 27 Aug 2011 08:08:20 +0100
Subject how to format long if conditions
From Arnaud Delobelle <arnodel@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.457.1314428909.27778.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1314428909 news.xs4all.nl 2551 [2001:888:2000:d::a6]:43375
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12252

Show key headers only | View raw


Hi all,

I'm wondering what advice you have about formatting if statements with
long conditions (I always format my code to <80 colums)

Here's an example taken from something I'm writing at the moment and
how I've formatted it:


        if (isinstance(left, PyCompare) and isinstance(right, PyCompare)
                and left.complist[-1] is right.complist[0]):
            py_and = PyCompare(left.complist + right.complist[1:])
        else:
            py_and = PyBooleanAnd(left, right)

What would you do?

-- 
Arnaud

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


Thread

how to format long if conditions Arnaud Delobelle <arnodel@gmail.com> - 2011-08-27 08:08 +0100
  Re: how to format long if conditions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-27 17:24 +1000
    Re: how to format long if conditions Arnaud Delobelle <arnodel@gmail.com> - 2011-08-27 11:24 +0100
    Re: how to format long if conditions Ben Finney <ben+python@benfinney.id.au> - 2011-08-27 22:04 +1000
  Re: how to format long if conditions Hans Mulder <hansmu@xs4all.nl> - 2011-08-27 09:50 +0200
    Re: how to format long if conditions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-27 19:05 +1000
      Re: how to format long if conditions Hans Mulder <hansmu@xs4all.nl> - 2011-08-27 12:51 +0200
    Re: how to format long if conditions "Colin J. Williams" <cjw@ncf.ca> - 2011-08-27 11:16 -0400
      Re: how to format long if conditions Hans Mulder <hansmu@xs4all.nl> - 2011-08-27 17:53 +0200
        Re: how to format long if conditions "Colin J. Williams" <cjw@ncf.ca> - 2011-08-27 17:25 -0400
  Re: how to format long if conditions Roy Smith <roy@panix.com> - 2011-08-27 12:39 -0400

csiph-web