I have a function
def static_nat_fwsm_check(mapped_to_real_address_pairs,FWSM_ACLs):
amended_static_nat_acl=[]
for acl_line in FWSM_ACLs:
for i,j in mapped_to_real_address_pairs:
if j in acl_line:
amended_static_nat_acl.append('!STATIC NAT SUBSTITUTION FOR '+acl_line)
amended_static_nat_acl.append(re.sub(j,i,acl_line))
break
else:
amended_static_nat_acl.append(acl_line)
return amended_static_nat_acl
The idea behind the function is to take a list of tuples and a list of strings as arguments. The tuples contain a mapping of real addresses to mapped addresses. If the mapped address is found in the string in the list, then it is replaced with the real address
The last line in the list of strings is added twice to the new list I am creating. When I step through the function adding print statements, it looks like the last tuple in the list is evaluated twice.
I could sidestep the problem by adding another if statement to the else clause, but I'd like to understand where I'm going wrong. Any assistance greatly appreciated!