Equality and identity

Dan Bishop danb_83 at yahoo.com
Tue Mar 30 21:30:15 EST 2004


Marius Bernklev <mariube+netnews+ at ifi.uio.no> wrote in message news:<3cfvfkmi337.fsf at nelja.ifi.uio.no>...
> In python, it seems like immutable objects are equal under both
> equality and identity:
> 
> >>> 5 == 5
>  True
> >>> 5 is 5
>  True
> >>> "hei" == "hei"
>  True
> >>> "hei" is "hei"
> True

>>> x = 100
>>> x is 100
False



More information about the Python-list mailing list