Post History
Replace if/else expressions by array subscripts Consider the statement a=b if x<y else c You can get rid of the expensive keywords by using the implicit conversion of boolean values to inte...
Answer
#1: Initial revision
# Replace if/else expressions by array subscripts Consider the statement ``` a=b if x<y else c ``` You can get rid of the expensive keywords by using the implicit conversion of boolean values to integer and array indexing: ``` a=[b,c][x<y] ``` Note however that here `b` and `c` are evaluated unconditionally, therefore this replacement doesn't work if b or c are expressions with side effects.