How can I write this succinctly without allocating an additional list?
I have the following code
Finding max element
Which one of the operation is better to find the max element?
Python performance of getting a new list with an additional value
To get a new list from a list with an additional value, I used to think that list_b = [*list_a, value]
is more performant than list_b = list_a + [value]
, as the latter generates an intermediate [value]
.