== versus is operators and type()
jeremy at zope.com
Wed Feb 26 20:16:31 CET 2003
> As an example, are the two expressions bellow totally equivalent?
> type(arg) is type(0) or type(arg) is type(0.0)
> type(arg) in (type(0), type(0.0))
Yes, in general. All of the standard Python types, including classes,
define equality using object identity. It's never the case that there can
be two type objects that are equal but have different addresses. So the
behavior of == and is operations are the same.
More information about the Python-list