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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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