I have a tuple of tuples. Each tuple within the tuple can be itself a tuple of tuple with no particular limitation in the nesting.
I would like to flatten this into a single tuple containing all the elements in the same order than a print would print them on screen.
For example:
a = ( 1 , (2, 3), (4, (5), (6, 7, (8, 9))))
would become:
( 1 , 2, 3, 4, 5, 6, 7, 8, 9 )
I may be wrong but I have not seen the same question. I am quite new to Python so I do not know if there is a Python way to do this (I would have gone for a generator personally).