Hi Stephen,
I think this is a legitimate complaint from pylint. Consider the case where `job.devices` is an empty iterable (a list with no members, perhaps). In that case, neither the name `device_id` nor the name `device` will have been bound to any object, and therefore, there's no way to satisfy the `del` statement.
Indeed, if you run a simple program like this:
collect = []
# collect = ["hello"] # for comparison
for member in collect:
value = member.upper()
del member
del value
You get the same pylint warning, but better yet, you get a `NameError` raised at the point of the `del`. Your suggestion of moving the loop to the function would alleviate the problem, since there would be no need for the explicit `del`. If that's unavoidable, you could add an explicit `device = device_id = None` before the start of the for loop.
Hope this helps!
tjs