Ask Your Question

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

asked 2020-02-21 12:54:52 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.


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
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-02-21 20:43:40 -0600

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-02-21 12:54:52 -0600

Seen: 113 times

Last updated: Feb 21 '20