Old #Python: first = items[0]; rest = items[1:] New Python: first, *rest = items Starred unpacking arrived in Python 3.0. The * collects whatever's left — and it works in the middle, too: first, *middle, last = items.
3 likes 0 replies
?
Old #Python: first = items[0]; rest = items[1:] New Python: first, *rest = items Starred unpacking arrived in Python 3.0. The * collects whatever's left — and it works in the middle, too: first, *middle, last = items.
3 likes 0 replies