Is there any problem between using the pop method and for loops when we they are not using the same variables as each other?
This is my code.
def tagsnotused(self):
tag_list = self.Tags
tag_list_Names = []
# ~ append list by object Name to use index method later
for Tag in self.Tags:
tag_list_Names.append(Tag.Name)
for Tag in self.Tags:
# ~ a = 0 tag processed, a = 1 tag not processed
a = 0
# ~ Adding tails
TagName0 = Tag.Name + "."
TagName1 = Tag.Name + "["
TagName2 = Tag.Name + ")"
# ~ Loop for looking conditions
for Prog in self.Program:
for Rout in Prog.Routine:
for Rng in Rout.Rung:
# ~ Condicional para encontrar tag
if (Rng.Content.find(TagName0) != -1 or Rng.Content.find(TagName1) != -1 or Rng.Content.find(TagName2) != -1) and a == 0:
a = 1
index = tag_list_Names.index(Tag.Name)
value = tag_list.pop(indice)
tag_list_Names.pop(indice)
return tag_list
The problem is that everytime I am making value = tag_list.pop(indice)
the for loop is jumping one element and going to the next one.
self.Tags
is as follows list[_object]