You call this optimized?
Python 3

Seems fast...

 print(0 &lt; 10**100 - 1 &lt; 10**100)


Seems slow...

 print(10**100 - 1 in range(0, 10**100))


But the two run in very similar times! range has an efficient implementation of in