The reason behind the speed is that in Python 3+ we're using mathematical reasoning about the bounds instead of a direct iteration. It just check all the objects between start and stop and stride value doesn't step over the numbers.
For Ref. you can check the following code:
>>> y, x = 10000000000000, range(10000000000001)
>>> class MyInt(int):
... pass
...
>>> y_ = MyInt(y)
>>> y in x # calculates immediately :)
True
>>> y_ in x # iterates for ages.. :(
^\Quit (core dumped)
Happy Learning.