On 02/10/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > I had no idea you could have an 'else' tied to a 'while' loop. > Interesting....
It allows you to distinguish between exiting the loop via a break and exiting the loop normally. eg: >>> for i in range(10): ... break ... else: ... print 'foo' ... >>> for i in range(10): ... pass ... else: ... print 'foo' ... foo >>> There was a discussion of for..else linked in Dr Dobb's Python URL recently: http://groups.google.com/group/comp.lang.python/browse_thread/thread/bc1d8038e65c449/ -- John. _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
