answered 2020-02-18 19:32:33 +0100
As another option, you can define side as follows:
side
side(u) = 2*unit_step(u) - 1
Hence
sage: [side(a) for a in range(-2,3)] [-1, -1, 1, 1, 1]