I am familiar with the spread/rest syntax in JavaScript:
// spread syntax const foo = [1, 2]; const bar = [3, 4]; console.log([...foo, ...bar]); // [1, 2, 3, 4] // rest syntax function baz(...nums) { console.log(nums); } baz(1, 2, 3); // [1, 2 ,3] I know how to concatenate arrays.
foo = [1, 2, 3] bar = [*foo, 4, 5] print(bar) # [1, 2, 3, 4, 5] Is there a way to use the Rest Syntax in python?
PS: Look at the second JS example.
...is not an "operator"; it's a syntax construct but it's not part of the expression grammar. In Python, you can use the+operator to do concatenation things on arrays.*. So,[1, 2, *bar, 5, 6]or for your example,[*foo, *bar]