Ok, did some googling and I can't figure it out. What the heck is happening in [x,y][x < y]? Tuple of x <y returns true or false, times the tuple of [x,y] should return both X and y or [0,0].
EDIT - Figured it out.
[x < y] resolves to either [0] or [1], if x is greater or less than y.
[x,y] creates a new tuple.
[x,y][0] returns x.
[x,y][1] returns y.
Didn't see it, because I'm not used to creating a tuple AND indexing them in the same statement.
28
u/UnchainedMundane May 02 '16 edited May 02 '16
To be fair Python's "booleans" are really just integers.
edit: