If we were to change the C implementation for
list.append() to take any number of arguments, I believe it would result in a significant performance loss for single arg appends. This is very significant, considering how frequently it’s used; particularly in decent-sized for loops with many calls to
In the case of the example posted above, I don’t see it as an issue to have to call append twice. If you’re adding many items (4+), you can simply create a temporary list or any other iterable and use
list.extend(). The performance and memory cost of doing so is very negligible, especially considering that the need comes up rather infrequently in comparison to using a single
Also, multi-arg append was intentionally made illegal, back in Python 1.6. See https://grokbase.com/t/python/python-list/002wztgmmg/multi-argument-append-is-illegal. The context was a bit different (apparently, it previously would append a tuple), but I think some of the same points in there may still be relevant.
As a result, I personally don’t think we should change
list.append() to take multiple arguments. This seems to be the case of a feature that sounds convenient in theory, but in practice would be too much of a detriment to be worth changing the existing implementation.