On Fri, Jun 17, 2011 at 9:29 AM, Erik Max Francis <m...@alcyone.com> wrote: > Chris Angelico wrote: >> >> On Fri, Jun 17, 2011 at 8:07 AM, Erik Max Francis <m...@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. ChrisA -- http://mail.python.org/mailman/listinfo/python-list