4 ms·
Well, break is an explicit statement that will force execution to continue after the current block. I.e. it breaks out of the current list of of statements. I'
by ant6n 8y ago
Well, break is an explicit statement that will force execution to continue after the current block. I.e. it breaks out of the current list of of statements.
I'd argue that flowing through cases is a very implicit behavior. It would be the only control-flow behavior in Python where execution continues at a sibling block. I think it kind of follows from the way switch statements used to be implemented using jump-tables in C, and is pretty surprising for people who learn the language today (i.e. those who didn't learn C by first learning assembler).
I'd argue that flow-through should be made explicit, e.g. using "continue" -- if it's a necessary feature, which is yet another discussion.