My dictionary has the following structure:
a = 'stringA'
b = 'stringB'
c = 'stringC'
endpoints = {
'foo1': a + 'string1' + b,
'foo2' : a + 'string2' + c + 'string3' + b,
}
My problem is the following: when I call endpoints['foo2'], I get the expected array value. However, when I change the value of, for instance, c between the array declaration and the usage of endpoints['foo2'], the value of c is not updated.
Any idea of why this happens and how can it be solved?
PS: I know this could be done creating a simple function, but I think that would be quite more inefficient.
cendpointsis a dictionary.cendpointsis created and it would take a re-definition of the particular entry to change it. @Alvaro would have to doc='newString'followed byendpoints['foo2'] = a + 'string2' + c + 'string3' + bor use a lambda function like Kevin Guan suggested.