PEP 315: Enhanced While Loop

andrew cooke andrew at acooke.org
Mon May 5 12:07:47 EDT 2003


but what does it do?  i've not been following this thread and so these are
all "honest" reactions to the syntax:

- if condition1 is true but condition2 is false is code1 repeated?
- what if condition2 is true but condition1 is false?
- is there any meaning for "or while"?
- if condition1 and condition2 are both true do both code1 and code2 get
repeated together, or is nesting implied (does code2 repeat until
condition2 is false then you start with code1 again?)?

these aren't necessaril criticisms - maybe i'd ask similar things about
existing constructs if they were new to me.  but it doesn't seem totally
obvious what the answers are (i'm guessing the answers are: yes, nothing,
no, together, but i'm not 100% sure on any of them)

andrew

Dirk Gerrits said:

> I already expessed that I like the general idea of the proposed
> construct. But I agree with others that the proposed syntax is not too
> clear.
>
> Andrew Koenig wrote:
>> By implication, there is no obvious reason that one could not write
>>
>>         while <condition1>:
>>             <code1>
>>         and while <condition2>:
>>             <code2>
>>         and while <condition3>:
>>             <code3>
>>
> [snip]
>>
>> Looking at these examples, I find myself liking the "and while" idea
>> more,
>> because it uses (negative) indentation to mark the possible exit points.
>
> This on the other hand seems to express the intent a lot better. Great
> idea Andrew! FWIW, I'm +1 on this.
>
> Regards,
> Dirk Gerrits
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>


-- 
http://www.acooke.org/andrew





More information about the Python-list mailing list