May-24-2019, 11:12 PM
i have this code in a large loop:
how can i diagnose what is going on with break?
for retry in range(128): ... lots of code to set up a cloud API call, do the call, and scan the results. print('usevpcs =',repr(usevpcs)) if usevpcs: print('break out of the retry loop') break # this should break out of for retry but it does not print('staying in the retry loop',retry) ... more code to react to a failed call attemptvariable usevpcs is an empty list unless a vpc is found and appended to it by previous code. when i run this script i get output like:Output:usevpcs = ['vpc-028f01f264af6bb1b'] break out of the retry loop staying in the retry loop 29so it looks like usevpcs has a string in it (a successful cloud API call) and tests True by the if statement, but the break statement doesn't break out.how can i diagnose what is going on with break?