Erro de sintaxe com operador ternário

Eu sou novo em Python e estou tentando usar o operador ternário que tem esse formato (acho que sim)

value_true if <test> else value_false

Aqui está um trecho de código:

expanded = set()

while not someExpression:

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

    # some code here

Mas o Python não gosta e diz:

SyntaxError: invalid syntax (pointed to if)

Como corrigi-lo?

questionAnswers(1)

yourAnswerToTheQuestion