Python type() or __class__, == or is
Python type() or __class__, == or is Question: I want to test whether an object is an instance of a class, and only this class (no subclasses). I could do it either with: obj.__class__ == Foo obj.__class__ is Foo type(obj) == Foo type(obj) is Foo Are there reasons to choose one over another? (performance differences, …