Should never use 'is' to test equality - unless for 'None' in which case None is guaranteed to be the same object (which is what the 'is' test checks).  This test works because Python (as an optimization) stores small integers as singleton objects, but this is an implementation detail that we should not rely on: http://stackoverflow.com/questions/1504717/why-does-comparing-strings-in-python-using-either-or-is-sometimes-produce