⬅︎ Back to Ruby and Python benchmarked
Nice, that's a trick I haven't used before. I like it. :)
Ah, I found a way to solve this in python. I can define a hash indexed by true and false. e.g. {true: 0, false: 1}[a[i] == b[j]] does the same as a[i] == b[j] ? 0 : 1
Comment
Nice, that's a trick I haven't used before. I like it. :)
Parent comment
Ah, I found a way to solve this in python. I can define a hash indexed by true and false. e.g. {true: 0, false: 1}[a[i] == b[j]] does the same as a[i] == b[j] ? 0 : 1