
On 14-11-2014 16:41, Aline Manera wrote:
The logic makes sense but that's not what that code snippet does. The keyword "continue" will skip the current iteration of the *inner loop*, not the outer one - which I guess is what you intended. In other words, the inner loop doesn't do anything.
No - I want to skip only the inner loop
You may want to skip the inner loop but the keyword "continue" skips the current iteration of the inner loop. And that's different. Take a look at the code again: 1) for res, items in params.iteritems(): 2) resources = getattr(self, '%s_get_list' % res)() 3) for i in resources: 4) if i in items: 5) continue Line 5 tells the program execution to skip the current iteration of the current [inner] loop and to go to line 3 with the next available element into the variable i, if there's any. Whether this inner loop executes or not, it doesn't make a difference.