Thank you, I have been through the tutorial several times, I guess I'm just not smart enough. Perhaps I have been led astray by what I read here?
My code started like this: for i in range(self.parent.GetPageCount()): I was asked: >Does page count change? i.e. is it necessary to retrieve it in every loop Is self.parent.GetPageCount() 'retrieved every loop'? Steve. "Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > En Sun, 26 Aug 2007 22:58:35 -0300, bambam <[EMAIL PROTECTED]> escribi?: > >> Ok, many environments are capable of cached evaluation >> of functions without variable parameters so >> range(5) >> is cached, but >> range(v) is re-evaluated every time. Is this defined >> behaviour? > > The range builtin function returns a list, and lists are mutable objects, > so it must return a *different* list each time. > >> That is, is it defined what Python does for >> for i in f() >> I'm sure it must be, but I haven't seen it yet. If I have >> a user defined function returning a range, is it defined >> that the range function is called on every loop? If I >> have a function returning a range taking a parameter, >> for i in f(v) >> is it defined that the variable is evaluated for every loop? > > Find all the (mostly negative) answers yourself in > <http://docs.python.org/ref/for.html> > > -- > Gabriel Genellina > -- http://mail.python.org/mailman/listinfo/python-list