Guido van Rossum wrote: > Why are you so excited about having until indented? You didn't give > any examples with multiple occurrences. A single occurrence works just > fine unindented, as PEP 315 has already shown. FWIW, I must say I disagree (about "works just fine"). I find PEP 315 counter-intuitive. There's multi-part blocks in Python, but they all behave like a step-sequence where you never come back to a previous step. What I mean is that after entering a finally/except/elif/else, there's no coming back in the try/if/for/while. My first impression when looking at: do: <block1> while condition: <block2> is that <block1> is executed only once. Yes, it would not make any sense since you would write instead: <block1> while condition: <block2> But, FWIW, that's still my impression. I remember reading Stroustrup saying he was never using do-while loops because he find them counter-intuitive. I feel the same way. I think this is important, because it means that even if do-while is available in C++, some programmers, even the creator himself, are still always using while loops. Even if different languages, I don't see why that would be different in Python. My mental image of a do-while loop looks more like a while-True-if-break Python loop than a PEP315-like loop. For one thing, since the loop content is executed at least once, I think about the condition breaking the loop, not the one maintaining it alive. The keyword 'until' has been proposed; I guess it would be as in Perl where it is an equivalent of "while not". Also, the "do" keyword means nothing to me; maybe something like "loop" would be better. Still, my feeling is that Python is just getting it right with the status quo. Regards, Nicolas
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4