I tend to agree with you in theory.

To recap:

MISRA-C 1998  [No gotos, no breaks (except in switches), no continues]
MISRA-C 2004  [No gotos, no continues, one break per loop (and also the switches)]
MISRA-C 2012  [Some gotos are now allowed!]

C is not python, but this translated to the teaching community and here we are.

Carried forward into python:
http://www.csee.umbc.edu/courses/201/spring13/standards.shtml

In practice, many many students are being told to avoid break/continue.

Maybe something from the Python leadership saying breaks are fine?  Given their lack of
support for gotos it's easy to see how others might feel breaks and continues are bad as well,
even in Python.


-----Original Message-----
From: Ned Batchelder <ned@nedbatchelder.com>
To: python-ideas <python-ideas@python.org>
Sent: Tue, Jun 25, 2013 1:08 pm
Subject: Re: [Python-ideas] Is this PEP-able? for X in ListY while conditionZ:

You don't have to: use the break statement, that's what it's for.   About people teaching students not to use it: the existence of bad teachers teaching silly ideas is not a reason to add syntax to Python.

--Ned.

On 6/25/2013 10:46 AM, jimjhb@aol.com wrote:

You shouldn't have to invoke takewhile and a lambda just to break out of for loop.
>http://docs.python.org/2/library/itertools.html#itertools.takewhile
>
>for item in takewhile(lambda x: x < 5, range(10)):
>    pass

>>
>> [People who avoid the 'break' by functionalizing an inner portion of the
>> loop are just kidding themselves and making their own code worse, IMO.
>> Takewhile from itertools also works, but that's clumsy and wordy as well.]
>>



_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas