Python indentation

David Fraser davidf at sjsoft.com
Fri Jul 9 17:49:06 CEST 2004


Paramjit Oberoi wrote:
>>>Yes, and I would also be interested in an other proposal
>>>that went something like:
>>>
>>>
>>>while condition1:
>>>  code
>>>and while condition2:
>>>  code
>>>and while condition3:
>>>  code
> 
> 
> Andrew Koenig proposed this in the following email:
> 
> http://groups.google.com/groups?q=g:thl470833922d&dq=&hl=en&lr=&ie=UTF-8&selm=yu99isspv9mm.fsf%40europa.research.att.com
> 
> If link doesn't work - it was a post dated 2003-05-05 with the subject
> "Re: PEP 315: Enhanced While Loop".  There was a fairly long thread about
> it back then.
> 
> 
A quote from the message:
>         while <condition1>:
>             <code1>
>         and while <condition2>:
>             <code2>
>         and while <condition3>:
>             <code3>
> 
> [snip] would be equivalent to
> 
>         while <condition1>:
>             <code1>
>             if not (<condition2>): break
>             <code2>
>             if not (<condition3>): break
>             <code3>

The thing is, to me as an English speaker, there is no logical 
correlation between the proposed syntax and its semantics.
For example, why shouldn't code3 be executed if condition2 is false and 
condition3 is true?

David



More information about the Python-list mailing list