[Solved] Possible to extend two lists at once?


It is not directly possible, because what must be on the left side of an assignment cannot be a function call. It can only be built from simple variables, data members, subscripts and commas, parentheses or square brackets.

Best that can be done is to use a comprehension or a map on the right side:

list_1, list_2 = map(lambda x: sum(x, []), zip((list_1, list_2), lists()))

(thanks to @meowgoesthedog for that way)

Whether it is better that a clear code using 3 lines is up to the reader. IMHO the only real use case would be inside a lambda which only supports a unique expression

3

solved Possible to extend two lists at once?