Hacker News new | ask | show | jobs
by cygx 836 days 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.

1 comments

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