Ron Adam wrote: >> >>> 'abc' is 'abcd'[:3] >> False > > Well of course it will be false... your testing two different strings! > And the resulting slice creates a third. > > Try: > > ABC = 'abc' > > value = ABC > if value is ABC: # Test if it is the same object > pass
That's not going to buy you any time above the "is None", because identity- testing has nothing to do with the type of the object. Additionally, using "is" with immutable objects is horrible. Reinhold -- http://mail.python.org/mailman/listinfo/python-list