August 14th, 2012, 07:47 AM
Infinite loop with WHILE
I am posting a snippet of my code:
XsdModelList = self.Api.XsdModelList
self.Api.XsdModelList is a list; when I run my code I am getting stuck in an infinite loop. can someone help what i am doing wrong?
August 14th, 2012, 08:43 AM
Could you not use a for loop instead
for item in XsdModelList:
August 14th, 2012, 10:08 AM
It's possible that the XsdModelList object has an unusual definition of its __len__ method.
def __len__(self): return 18
[/code] are essential for python code and Makefiles!
August 15th, 2012, 07:28 PM
Hmm, I used some print statements to see whats happening, the len() function counts down like it should and then stops at 0, but strangely the loop does not exit
August 15th, 2012, 07:30 PM
Yup, thats the way I am using it right now, its just unusual that the loop didn't work the way I thought it should.
Originally Posted by Quackajack
September 3rd, 2012, 06:51 PM
You don't use a while loop for something like this
a = [1,2,3]
for x in a: