First time here? Check out the FAQ!

What is syntax error in line 'elif item is not None:'


def _flatten(seq):
    """Internal function."""
    res = ()
    for item in seq:
        if is instance(item, (tuple, list)):
            res = res + _flatten(item)
elif item is not None:
        res = res + (item,)
    return res

try: _flatten = _tkinter._flatten
except AttributeError: pass
updated 2020-02-21 12:54:52 -0500
This post is a wiki. Anyone with karma >75 is welcome to improve it.
edit flag offensive 0 remove flag close merge delete


add a comment see more comments

1 Answer


If it's indented as above (under the 'def' not the preceding 'if') then it's not valid. I don't know if this is a side effect of having pasted it into here or not. I edited the question to add formatting without changing the text, but don't know if the text is what you had in the editor.

Wingware Support's avatar
Wingware Support
answered 2020-02-21 20:43:40 -0500
edit flag offensive 0 remove flag delete link


add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer