51 ms·
Maybe more obvious, it also works the other way around. Saving you from doing [head] + body + [tail] or keeping copies of temporary arrays manipulated with appe
by Too 4y ago
Maybe more obvious, it also works the other way around. Saving you from doing [head] + body + [tail] or keeping copies of temporary arrays manipulated with append and extend.
arr = [head, *body, tail]
Same with dictionaries, often very useful when you need to include **os.environ with modifications into a subprocess.