OK this is truly weird:
>>> a=16
>>> a*a is a*a
True
>>> a=17
>>> a*a is a*a
False
WTF >>> a=16
>>> a*a is a*a
True
>>> a=17
>>> a*a is a*a
False
WTFSee https://stackoverflow.com/questions/306313/is-operator-behav... for some discussion and further related links.
Otherwise you'll end up thinking that almost everything is simply an alias for constant True or 0 or Error, by popping in 0 to any operator you check.
At the CPython level, you can explain it in terms of the particular range of small integers that are interned and thus are guaranteed within particular CPython versions to share object identity when they have value equality.
But just knowing that is identity and == is equality is mostly enough to use them correctly.