Python “bool” — wat?
Tim Bell

The behaviour in cases 4, 5 and 6 is a long-standing bug, due to an overeager optimization in a division fast path in the source code (and yes, that fast path exactly matches the conditions you identified). That bug is fixed for Python 3.6 (thanks to Xiang Zhang), but it’s minor enough that it’s probably not worth fixing for earlier Python versions. See Thanks for this post: without it, this bug would probably have remained unnoticed and unfixed!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.