def flatten ( iterables ) : for it in iterables : if isinstance ( it , str ) : yield it else : for element in it : yield element
how to fold an array of strings in python
Flatten an iterable except for string elements .
def flatten( iterables ):
    """ Flatten an iterable, except for string elements. """
    for it in iterables:
        if isinstance(it, str):
            yield it
        else:
            for element in it:
                yield element