top | item 39536471

(no title)

cygx | 2 years ago

It's a valid criticism: By the principle of least surprise, one should strive for a//b = int(a/b).

Basically, there's no free lunch. Personally, I prefer truncating integer division in combination with a pair of remainder operators.

discuss

order

odyssey7|2 years ago

Inspired by Monty Python, the surprises are part of the charm. ¯\_(ツ)_/¯