ischecks if two variables are stored in the same memory location. The following states indicate that these two numbers are stored in different places in memory:
>>> 512 is (2**9)
False
Most likely, you really wanted to know if the numbers were equal. To do this, check the equality:
>>> 512 == (2**9)
True
Exceptional case: None
Nonehas no reasonable meaning. Therefore, checking that something is equal is Noneusually not useful. To find out if there is any variable None, use is:
>>> x = None
>>> x is None
True