On Fri, 16 Mar 2012 00:46:35 +0100, Kiuhnm wrote: > On 3/16/2012 0:00, Arnaud Delobelle wrote: >> On 15 March 2012 22:35, Ben Finney<ben+pyt...@benfinney.id.au> wrote: >>> Kiuhnm<kiuhnm03.4t.yahoo.it> writes: >>> >>>> Moreover, I think that >>>> if (............ >>>> ............ >>>> ............): >>>> ............ >>>> ............ >>>> ............ >>>> is not very readable anyway. >>> >>> I agree, and am glad PEP 8 has been updated to recommend an extra >>> level of indentation for continuation, to distinguish from the new >>> block that >>> follows<URL:http://www.python.org/dev/peps/pep-0008/#indentation>. >> >> Personally I solve this by never writing if conditions that span more >> than one line. If the worst comes to the worst, I would write: >> >> aptly_named_condition = ( >> very long condition >> that goes over >> plenty of lines >> ) >> if aptly_named_condition: >> do stuff > > Will I be able to use extra indentation in Python code? For instance, > > res = and(or(cond1, > cond2), > cond3, > or(and(cond4, > cond5, > cond6), > and(cond7, > cond8)))
Not that exact example, because `and` and `or` are operators, not functions and you will get a syntax error. Python uses infix notation, not prefix or postfix: x and y # yes and(x, y) # no x y and # no But in general, yes, you can use whatever indentation you like inside a line-continuation bracket: py> x = [ ... 1, 2, 3, ... 4, 5, 6, ... 7, 8, 9, ... 10, 11, 12, ... 13, 14, 15 ... ] py> x [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] Indentation is only syntactically significant in blocks and statements. > I like it because it reads like a tree. Funny. I dislike it because it is a tree on its side. -- Steven -- http://mail.python.org/mailman/listinfo/python-list