I am working with a large object a in Python. The object has two other iterable objects b and c passed to it as attributes one and two.
I want to consolidate the important data in the object prior to passing it to the templating engine. I am trying to take an attribute from one and assign it to two.
My first thought was to parse the two objects with two stacked for loops like this..
for c in a.two:
for a in a.one:
if a.id == c.id:
setattr(c, 'title', a.title)
However, I am not sure if this is the most pythonic way of doing this.
itertoolsor something to reduce the time complexity of it!idsas they will sometimes act in unexpected manners especially on multi threaded programs...