Can I set the capacity of a list when I already know the size the list will eventually have? I'm trying to avoid Python reallocating memory when appending items to it.
In the constructor, setting capacity, size, length or len does not work.
def merge_lists(a, b):
    result = list(capacity=len(a) + len(b))
    ...
Edit: ...without having to actually add any elements.
 
     
    