Błąd składniowy z operatorem trójskładnikowym

Jestem nowym użytkownikiem Pythona i staram się używać trójargumentowego opertora, który ma ten format (tak myślę)

value_true if <test> else value_false

Oto fragment kodu:

expanded = set()

while not someExpression:

    continue if currentState in expanded else expanded.push(currentState)

    # some code here

Ale Pythonowi się to nie podoba i mówi:

SyntaxError: invalid syntax (pointed to if)

Jak to naprawić?

questionAnswers(1)

yourAnswerToTheQuestion