Re: how to format long if conditions

2011-08-27 Thread Colin J. Williams
On 27-Aug-11 11:53 AM, Hans Mulder wrote: On 27/08/11 17:16:51, Colin J. Williams wrote: What about: cond= isinstance(left, PyCompare) and isinstance(right, PyCompare) and left.complist[-1] is right.complist[0] py_and= PyCompare(left.complist + right.complist[1:])if cond else: py_and = PyBoolea

Re: how to format long if conditions

2011-08-27 Thread Roy Smith
In article , Arnaud Delobelle wrote: > Hi all, > > I'm wondering what advice you have about formatting if statements with > long conditions (I always format my code to <80 colums) > [...] > if (isinstance(left, PyCompare) and isinstance(right, PyCompare) > and left.compl

Re: how to format long if conditions

2011-08-27 Thread Hans Mulder
On 27/08/11 17:16:51, Colin J. Williams wrote: What about: cond= isinstance(left, PyCompare) and isinstance(right, PyCompare) and left.complist[-1] is right.complist[0] py_and= PyCompare(left.complist + right.complist[1:])if cond else: py_and = PyBooleanAnd(left, right) Colin W

Re: how to format long if conditions

2011-08-27 Thread Colin J. Williams
On 27-Aug-11 03:50 AM, Hans Mulder wrote: On 27/08/11 09:08:20, Arnaud Delobelle wrote: 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 for

Re: how to format long if conditions

2011-08-27 Thread Ben Finney
Steven D'Aprano writes: > I believe that PEP 8 now Specifically the “Indentation” section contains:: When using a hanging indent the following considerations should be applied; there should be no arguments on the first line and further indentation should be used to clearly distingui

Re: how to format long if conditions

2011-08-27 Thread Hans Mulder
On 27/08/11 11:05:25, Steven D'Aprano wrote: Hans Mulder wrote: [...] It may look ugly, but it's very clear where the condition part ends and the 'then' part begins. Immediately after the colon, surely? On the next line, actually :-) The point is, that this layout makes it very clear that

Re: how to format long if conditions

2011-08-27 Thread Arnaud Delobelle
On 27 August 2011 08:24, Steven D'Aprano wrote: > Arnaud Delobelle wrote: > >> 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

Re: how to format long if conditions

2011-08-27 Thread Steven D'Aprano
Hans Mulder wrote: [...] > It may look ugly, but it's very clear where the condition part ends > and the 'then' part begins. Immediately after the colon, surely? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: how to format long if conditions

2011-08-27 Thread Hans Mulder
On 27/08/11 09:08:20, Arnaud Delobelle wrote: 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,

Re: how to format long if conditions

2011-08-27 Thread Steven D'Aprano
Arnaud Delobelle wrote: > 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(

how to format long if conditions

2011-08-27 Thread Arnaud Delobelle
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, PyComp