Python is readable

Kiuhnm kiuhnm03.4t.yahoo.it
Fri Mar 16 00:46:35 CET 2012


On 3/16/2012 0:00, Arnaud Delobelle wrote:
> On 15 March 2012 22:35, Ben Finney<ben+python at 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)))

I like it because it reads like a tree.

Kiuhnm



More information about the Python-list mailing list