Flatten an array of integers in Python
Python normally promotes duck typing, yours is more statically typed.
You may want to use yield, as your current code possibly uses more memory than needed.
You can check if an item is iterable, and iterate it. Otherwise return the item.

You can do this in two ways either via LBYL or EAFP.


Just using yield can get:

def flatten_list(array):
    for element in array:
        if isinstance(element, int):
            yield element
        elif isinstance(element, list):
            yield from flatten_list(element)
        else:
            raise TypeError("Unsupported type ({})".format(
                type(element).__name__))


Using LBYL and duck typing can then get:

import collections


def flatten_list(array):
    for element in array:
        if isinstance(element, collections.abc.Iterable):
            yield from flatten_list(element)
        else:
            yield element


Using EAFP and duck typing can instead get:

def flatten_list(array):
    for element in array:
        try:
            element = iter(element)
        except TypeError:
            yield element
        else:
            yield from flatten_list(element)




Finally as a side note, if you expect the initial array to have a depth exceeding one thousand, then you may want to instead perform the stack manipulation yourself. So you don't get a stack overflow error.
This can be done with something like:

def flatten(it):
    to_yield = [iter(it)]
    sentinel = object()
    while to_yield:
        item = next(to_yield[-1], sentinel)
        if item is sentinel:
            del to_yield[-1]
            continue
        try:
            item = iter(item)
        except TypeError:
            yield item
        else:
            to_yield.append(item)