• Flatten a List

 

Hi friends.

Why code below don't call the inner function myext(arrayn)?

def flatlist(array): arrayn = array

def my_ext(array_n):                    # function for extend list
    rez = []
    for j in array_n:
        if isinstance(j,list):
            rez.extend(j)
        else:
            rez.append(j)
    array_n = rez
    return array_n

for ti_exp in range(10): my_ext(array_n)    # repeat function 10 times for extend of inner lists
return array_n
.