[Python-ideas] PEP 315: do-while

jimjhb at aol.com jimjhb at aol.com
Thu Jun 27 15:26:02 CEST 2013


(You have an extra period on your link....)


Andrew,


I'm not doubting what you are saying, but I am informing the python community of the reality out there.  Say what you will, but Python's
lack of gotos (if they are bad, then one can just avoid them, right?) is a form of social engineering on Python's part as well.  I think that's
a good decision, but one can see how social engineering of programmers can go awry as well.  (MISRA-C 2012 now allows for limited gotos, so times change.)


If I take the viewpoint of the no break/continue folks, they have a point.  They can often be avoided, and throwing them in (a lot) is often a sign of sloppy code.  Breaks (especially) are very easy to avoid with the C for, because the conditional is explicit and can easily be expanded.  So for C, educating folks with these rules don't really have much net effect.


The PROBLEM is that you can't do that with a Python for.  So all this rule indoctrination is much more consequential (to the code).


If can argue that adding a conditional SHOULDN'T be necessary, but that might not reflect our current practical reality.



-----Original Message-----
From: Andrew Barnert <abarnert at yahoo.com>
To: jimjhb <jimjhb at aol.com>; guido <guido at python.org>
Cc: python-ideas <python-ideas at python.org>
Sent: Wed, Jun 26, 2013 7:17 pm
Subject: Re: [Python-ideas] PEP 315: do-while


From: "jimjhb at aol.com" <jimjhb at aol.com>
Sent: Wednesday, June 26, 2013 1:48 PM


>Sounds good to me.  Just let people know it's OK to use breaks!!! 
>
>
>MISRA-C 1998 (I know it's C, but people extrapolated that to other languages) 
banned continues and breaks.
>MISRA-C 2004 allowed for one break in a loop.


In case it's not obvious how ridiculous it is to extrapolate MISRA-C to other 
languages…

I went through the 127 rules in MISRA-C 1998. About 52 of them could be 
extrapolated to Python. Of those, 20 make some sense; the other 32 would be 
either ridiculous or disastrous to apply in Python. (In fact, much the same is 
true even for more closely-related languages like C++ or JavaScript.)

If you're curious about the details, see http://stupidpythonideas.blogspot.com/2013/06/misra-c-and-python.html.


 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130627/e9fdcd60/attachment-0001.html>


More information about the Python-ideas mailing list