On Jun 27, 2013, at 9:53, jimjhb@aol.com wrote:
-----Original Message----- From: Ethan Furman <ethan@stoneleaf.us> To: python-ideas <python-ideas@python.org> Sent: Thu, Jun 27, 2013 12:43 pm Subject: Re: [Python-ideas] PEP 315: do-while
On 06/27/2013 07:48 AM, jimjhb@aol.com wrote:
Bottom line is most other languages allow early termination of for loops without breaking out of them. Python does not.
If they are terminating early, then they most certainly are breaking out of them, regardless of whether the word 'break' is used. Yes, but the control flow (and location of the control) is different. All this "don't use breaks" stuff can be traced back to E.W Dijkstra and structured programming. Structured programming remains in a lot of mindsets today. Structured programming is all about how to write maintainable programs in a low-level Algol-like language, and that's what C is. But that's not even close to what Python is. People trying to program Python as if it were C are going to write bad Python. Bending over backward to accommodate them will only make things worse.
The best thing we can do is use as many generators as possible--anyone who thinks break doesn't belong in Python will suffer from head-asplode once they finally realize what yield does to control flow, and then they'll no longer be a problem.