How to flatten a tuple in python

[(a, b, c) for a, (b, c) in l]

Tuple packing and unpacking solves the problem.


New in Python 3.5 with the additional tuple unpacking introduced in PEP 448, you can use starred expressions in tuple literals such that you can use

>>> l = [(50, (2.7387451803816479e-13, 219)), (40, (3.4587451803816479e-13, 220))]
>>> [(a, *rest) for a, rest in l]
[(50, 2.738745180381648e-13, 219), (40, 3.458745180381648e-13, 220)]

This could be useful if you had a nested tuple used for record-keeping with many elements that you wanted to flatten.