I have an array of objects where each object has a search_order attribute.
I was to go over the array and increase that attribute by 1 for all objects
This is the easy way:
res = []
for r in array:
r.search_order+=1
res.append(r)
return iter(res)
Is there a one line for loop that can accomplish this?
return (r.search_order+=1 for r in array)
Doest seem to work unfortunately.