if i have a list in python were i have a lot of numers example:
list = [1,2,3,12,4,5,23,5,6,56,8,57,8678,345,234,13, .....]
so a list of all integers, that all can have different values ... (i my case this list could be very long, and is actually not an integer list, but a list of Objects which are all from the same type an have a attribute age which is a integer) whats the most efficient way to add all those values by +1 is it
new_list = [x+1 for x in list]
or maybe
new_list = []
for x in list:
new_list.append(x+1)
(i guess it makes no difference)
or is there maby a more efficent way or an other data sructure to make this more performant? I really wonder if there is not any method, maybe using something different the a list were i can do this operation more efficient because the +1 seems son simple ...