break in a module
Ethan Furman
ethan at stoneleaf.us
Thu Jun 16 22:17:43 EDT 2011
Erik Max Francis wrote:
> Chris Angelico wrote:
>> On Fri, Jun 17, 2011 at 9:29 AM, Erik Max Francis <max at alcyone.com>
>> wrote:
>>> Chris Angelico wrote:
>>>> On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis <max at alcyone.com>
>>>> wrote:
>>>>> It's quite consistent on which control structures you can break out
>>>>> of --
>>>>> it's the looping ones.
>>>> Plus functions.
>>> No:
>>>
>>>>>> def f():
>>> ... break
>>> ...
>>> File "<stdin>", line 2
>>> SyntaxError: 'break' outside loop
>>
>> Yes:
>> def f():
>> return
>> print("Won't happen")
>>
>> "break out of" doesn't necessarily require the break keyword per se.
>> You can abort a function part way, same as you can abort a loop part
>> way.
>
> Look back at the context. I was actually talking about the break keyword.
The Context:
"It's quite consistent on which control structures you can break out of"
Hmmm.... Nope, nothing there to suggest you were talking about the
'break' keyword.
~Ethan~
More information about the Python-list
mailing list