Ignore part of a python tuple

Solution 1:

I personally would write:

a, _, b = myTuple

This is a pretty common idiom, so it's widely understood. I find the syntax crystal clear.

Solution 2:

Your solution is fine in my opinion. If you really have a problem with assigning _ then you could define a list of indexes and do:

a = (1, 2, 3, 4, 5)
idxs = [0, 3, 4]
a1, b1, c1 = (a[i] for i in idxs)

Solution 3:

Note that you can slice the source tuple, like this instead:

a,b = some_tuple[0:2]