Concatenating two lists – difference between ‘+=’ and extend()

The only difference on a bytecode level is that the .extend way involves a function call, which is slightly more expensive in Python than the INPLACE_ADD.

It’s really nothing you should be worrying about, unless you’re performing this operation billions of times. It is likely, however, that the bottleneck would lie some place else.

Leave a Comment