break in a module

Eric Snow ericsnowcurrently at gmail.com
Thu Jun 16 20:00:31 EDT 2011


On Thu, Jun 16, 2011 at 5:29 PM, 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
>

Yeah, I see what you mean.  I wasn't talking about the actual break
keyword, but rather having a "break" in execution.  Basically
execution of the current frame stops and returns; loop bodies aren't
handled in their own execution frames but effectively it's the same
idea.

So, a little namespace collision between us there on the words break
and return.  Regardless, for the only real use case I had for module
breaking flow control, I have a better solution anyway.  Thanks again
for your feedback.

-eric

> --
> Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
>  San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
>  Do not stand in a place of danger trusting in miracles.
>   -- (an Arab proverb)
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list