Jun
26
MISRA-C and Python
Recently, there have been a few proposals to change Python's syntax to make it easier to avoid break and continue statements.
The reasoning seems to be that many people are taught never to use break and continue, or to only have a single break in any loop. Some of these people are in fact forced to follow these rules for class assignments.
These rules are ludicrous. The stdlib has hundreds of break and continue statements. There are dozens of them in the official tutorial, the library reference docs, Guido's blogs, etc. The reasons for avoiding break and continue in other languages don't apply to Python, and many of the ways people use to avoid them don't even exist in Python. Using break and continue appropriately is clearly Pythonic.
The reasoning seems to be that many people are taught never to use break and continue, or to only have a single break in any loop. Some of these people are in fact forced to follow these rules for class assignments.
These rules are ludicrous. The stdlib has hundreds of break and continue statements. There are dozens of them in the official tutorial, the library reference docs, Guido's blogs, etc. The reasons for avoiding break and continue in other languages don't apply to Python, and many of the ways people use to avoid them don't even exist in Python. Using break and continue appropriately is clearly Pythonic.