Thank you, so generallizing: (1) Python re-evaluates the loop range on every loop, and (2) Python does short-circuit evaluation of conditions, in predictable order.
Sorry about the bad question. "Zentrader" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Does page count change? i.e. is it necessary to retrieve it in every > loop or > tempList = ['1','2','3','4','5','6','7','8'] > sampleList=[] > page_count = self.parent.GetPageCount() > <snipped> > for i in range(page_count): > > Also, once pagefound is set to True, all pages following will not be > appended to sampleList because it is not initialized to False under > the "for i in range(self.parent.GetPageCount())" loop. > > Finally, if I understand the logic and question correctly, you want > something like > tempList = ['1','2','3','4','5','6','7','8'] > sampleList=[] > page_count = self.parent.GetPageCount() > for port in tempList: > for i in range(page_count): > page=self.parent.GetPage(i) > if (hasattr(page, "port")) and (page.port != int(port)) : > sampleList.append(port) > > or perhaps (I'm not sure) > tempList = [1, 2, 3, 4, 5, 6, 7, 8] > sampleList=[] > page_count = self.parent.GetPageCount() > for i in range(page_count): > page=self.parent.GetPage(i) > if (hasattr(page, "port")) and (page.port not in tempList) : > sampleList.append(port) > HTH > -- http://mail.python.org/mailman/listinfo/python-list