On Feb 4, 12:56 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sun, 03 Feb 2008 05:33:16 -0800, Ivan Illarionov wrote: > > Plain Python function are very often more powerful than classes: > > >>>> def go(count): > > ... if not hasattr(go, 'count'): > > ... go.count = count > > ... if go.count <= 0: > > ... del go.count > > ... return False > > ... go.count -= 1 > > ... return True > > ... > >>>> while go(3): > > ... print 'hello' > > ... > > hello > > hello > > hello > > Please try: > > while go(3): > while go(3): > print 'Think about it...' > > Ciao, > Marc 'BlackJack' Rintsch
> Please try: > > while go(3): > while go(3): > print 'Think about it...' This doesn't work with nested loops as well as Go(count) and again(). I use 'for i in range(3)'. IMO it's good to name an index variable even if it's not used inside the loop - it has the noble purpose of being a loop index and therefore it is not 'dummy' in any way :). -- http://mail.python.org/mailman/listinfo/python-list