The is operator does not match the values of the variables, but the instances themselves.
is
What does it really mean?
As you can check here to a small integers. Numbers above 257 are not an small ints, so it is calculated as a different object.
It is better to use == instead in this case.
==
Further information is here: http://docs.python.org/2/c-api/int.html