why no "do : until"?
Peter Hansen
peter at engcorp.com
Sat Dec 30 21:12:13 EST 2000
More information about the Python-list mailing list
Sat Dec 30 21:12:13 EST 2000
- Previous message (by thread): why no "do : until"?
- Next message (by thread): why no "do : until"?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Steve Lamb wrote: > > On Sat, 30 Dec 2000 23:00:53 GMT, Kragen Sitaker <kragen at dnaco.net> wrote: > >Hahaha! You just plonked Fredrik Lundh in comp.lang.python. He was > > I can tell you I'll get far better without him than with him when he is > giving advice that runs contrary to about 10+ years of programming that I've > been taught from various different sources. I don't care if he is God > himself, advocating not initing a variable is stupid, plain and simple. He > wanted to argue the point for nothing more than argument's sake, so be it. I > don't need his advice any further. It appears to me that you've missed some of the points made in this "discussion". I would suggest you go back with an open mind and reconsider the validity of the opposing views. The advice that runs contrary to your 10+ years seems very reasonable to my 20+ years of programming experience, and apparently many others with a variety of experiences agree. I understand the point you are making; I'm just pointing out that the opposing views seem well-founded. Areas where I think you missed the point are in the importance of code maintainability, the increased complexity with your suggested approach, and the feelings of the "entire CS community" on this issue. If I may attempt to clarify what I believe is the opposing argument: you suggested an alternative which relies on initialization of a variable to a special value (anything less than 25) solely in order to enter a 'while' loop which you've rewritten to use the conditional at the top instead of at the bottom (because you believe there is some inherent advantage in doing this, though you've yet to explain what it is other than that the use of 'break' is somehow bad), and in the process you've demonstrated the *reason* others feel this is a poor approach, by leaving out the required initialization. And the first attempt to correct this was given using a wrong value for the initializer! That's the whole point: your approach is inherently open to such complexity/maintainability problems. Even experienced programmers can slip up in this way. I think those of us objecting have in our 10+ years of experience seen this kind of thing cause so many problems that we are happy with the single _idiomatic_ way which Python provides, in spite of a little so-called "ugliness". I suspect some of us would even argue that the conditional in 'do/until' can be difficult for some people to get right and that forcing the use of 'while/if/break' may actually increase the likelihood the resulting code will be correct the first time, and be interpreted correctly during maintenance. My guess is that for this precise reason the alternative loop construct was removed from/never added to Python in the first place.
- Previous message (by thread): why no "do : until"?
- Next message (by thread): why no "do : until"?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list