[Kimchi-devel] [PATCH 2/2] MockModel refactor: Create MockModel based on Model("test:///default")
Aline Manera
alinefm at linux.vnet.ibm.com
Fri Nov 14 18:53:21 UTC 2014
On 11/14/2014 04:51 PM, Crístian Viana wrote:
> 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.
No I want to skip only the current element, ie, I do exactly what I want
to do.
> 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.
Yes - it does. Try to run it locally with and without the inner loop and
after it the vms_get_list() must return only 'test'
More information about the Kimchi-devel
mailing list