print([ 3, if False never_called() unless False, if False never_called() unless False, 2, if True 5 unless False, 4 ]) # => [3, 2, 5, 4]
Do you mean this ?Currently what I use is the `*` operator on lists : ``` print([ 3, ] + ([never_called()] if False else []) + [ 2, ] + ([5] if True else []) + [ 4 ]) # => [3, 2, 5, 4] ``` (put the whitespaces where you want) And if the call to `never_called()` is not important (no need for shortcircuit) : ``` print([ 3, ]+ [ never_called() ] * False + [ 2, ] + [ 5 ] * True + [ 4 ]) # => [3, 2, 5, 4] ``` (put the whitespaces where you want) You could do things like L = [4,5,2] + ['hello', world'] * (a == 5) + [8,9] Of course, that's not as optimised as : L = [] L += [4,5,2] if a == 5: L += ['hello', world'] L += [8,9]