Hello Subhash, > --- BEGIN --- > counter = 0 > > def foo(): > if counter < 10: > print "count = ", counter > counter += 1 > > foo() > --- END --- Today we have generators: >>> def foo(): for count in range(10): print "count = ", count yield count count += 1 >>> gen = foo() >>> gen.next() count = 0 0 >>> gen.next() count = 1 1 >>> HTH. Miki