New to Python - block grouping (spaces)
Antoon Pardon
antoon.pardon at rece.vub.ac.be
Thu Apr 16 07:07:22 EDT 2015
On 04/16/2015 12:43 PM, Steven D'Aprano wrote:
> On Thursday 16 April 2015 20:09, Antoon Pardon wrote:
>
>> I beg to differ. The most common occurence is a loop with a break
>> condition in the middle I would prefer such a loop to be written as
>> follows:
>>
>> repeat:
>> some
>> code
>> break_when condition:
>> more
>> code
>
> That structure makes no sense to me. Why is the "break_when" *outside* of
> the loop? Why does the "break_when condition" introduce a new block?
How do you mean outside the loop? Do you consider the "else" outside the
if statement?
>> Actually I would prefer a more elaborate scheme but would be contend with
>> a possibility like the above. IMO this is the most occuring pattern where
>> the logical structure doesn't match the physical structure and it is not
>> occuring relevantly less now.
>
> Judging by the above example, I think it may be a good thing that Python
> doesn't allow "more elaborate" indentation schemes.
>
> repeat:
> do this
> do that
> do something else important
> and this
> sometimes this
> also this
> but don't do this
> unless today is Tuesday
> # end loop
>
>
>
> Simplicity is a virtue.
As is argueing against a real position instead of making something up.
Nobody is argueing for arbitrary indentation.
More information about the Python-list
mailing list