Conceptually, I want to do:
arr[20:] = 0
where arr is a list. How can I do this?
arr
list
If you use list comprehension you make a copy of the list, so there is memory waste. Use list comprehension or slicing to make new lists, use for cicles to set your list items correctly.