How to unpack a tuple from left to right?

In case you want to keep the original indices (i.e. don't want to bother with changing 4 and 7 to 6 and 3) you can also use:

v, b, n = (j[4:7][::-1])

You could ignore the first after reversing and use extended iterable unpacking:

j = 1, 2, 3, 4, 5, 6, 7


_, v, b, n, *_ = reversed(j)

print(v, b, n)

Which would give you:

6 5 4

Or if you want to get arbitrary elements you could use operator.itemgetter:

j = 1, 2, 3, 4, 5, 6, 7

from operator import itemgetter


def unpack(it, *args):
    return itemgetter(*args)(it)

v,b,n = unpack(j, -2,-3,-4)

print(v, b, n)

The advantage of itemgetter is it will work on any iterable and the elements don't have to be consecutive.


This should do:

v,b,n = j[6:3:-1]

A step value of -1 starting at 6


 n,b,v=j[4:7]

will also work. You can just change the order or the returned unpacked values