On Tue, 17 Apr 2001 09:28:15 -0700 Bob Cannard <bob_cannard at mentor.com> wrote: ) Has no one else found that the majority of while-type ) loops actually need some code before the test and some ) after? Doubly so in Python where it seems impossible ) to embed a local side effect in the while condition. ) As a result, most non-for loops degenerate into ) ) while 1: ) set up for this cycle ) if c: break ) whatever needs to be done That's a product of poor design. I consider it a failure to resort to this sort of construct. The only time I resort to it is with Error trapping code where you are forced to do something drastic. For the purpose of debugging code readability and reliability you are always better off doing things the "Right" way. -- Dennis ) ) Instead we keep getting suggestions for another loop ) structure that's comparable in lack of generality to ) "while", instead of taking a good look at how loops ) are formed in practice and generalizing the concept ) accordingly. If new syntax were to be added to the ) language, I'd rather see something like Dale's ) suggestion but removing the constraint that the UNTIL ) (or WHILE) statement has to be at the end - better yet, ) remove the constraint that there can be only one, thus ) making it a synonym for if...break. The existing while ) loop, and the repeat...until loop suggested above, are ) both special cases of the general loop. ) ) Cheers, ) ) Bob. ) -- ) http://mail.python.org/mailman/listinfo/python-list )
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