Never seen that before. Neat how the bool being a subclass of int pokes out in various ways.
A nice side effect is that bools can used with sum:
sum(x % 10 for x in range(1000))A nice side effect is that bools can used with sum:
sum(x % 10 for x in range(1000)) >>> {1} | {1.0}
{1}
>>> {1.0} | {1}
{1.0}
>>> import fractions
>>> x = fractions.Fraction(1)
>>> {x} | {1}
{Fraction(1, 1)}
>>> {1} | {x}
{1}For future internet historians, it should have been:
sum(x % 10 == 0 for x in range(1000))