4 ms·
An even more concise form is built in, and I think more obvious to readers: v.insert(v.end(), { 1, 2, 3, 4, 5 });
by jzwinck 6y ago
An even more concise form is built in, and I think more obvious to readers:
v.insert(v.end(), { 1, 2, 3, 4, 5 });
- einpoklum 6y agoI was actually not describing adding elements to a container, but adding up values.
- owl57 6y agoSee? That's the problem with arithmetic on containers. Python has that already: v += 4, 5, 6 Comma doesn't do weird shit: that's just a tuple of numbers. But "+=" then does weird shit: it means concatenation when v is a standard library list, and element-wise addition when v is a numpy vector.