\'Hello \' + (\'there\' if name is None else name)
Is the equivalent of
msg = \'Hello \' if name is None: msg += \'there\' else:
'Hello ' + \ ('there' if name is None else \ 'Neo' if name == 'Mr Anderson' else \ name)
I recommend against this; if your conditions become this complex, stick it in a function.