4 ms·
I prefer the js: ys = [1, ...xs, 5] It is more visually indicative of a 'spread' of values.
by somewhereoutth 3y ago
I prefer the js:
ys = [1, ...xs, 5]
It is more visually indicative of a 'spread' of values.
- squeaky-clean 3y agoIt's definitely more visually intuitive for someone new to the language. But Python has used asterisk for unpacking lists in other places, so the first time I saw it done for array spreading it made perfect sense.