Result of ``a is b''
Andrew Koenig
ark at acm.org
Mon Mar 15 19:38:09 EST 2004
"Axel Boldt" <axelboldt at yahoo.com> wrote in message
news:40200384.0403151632.35496ee6 at posting.google.com...
> is there a rationale for the following behavior:
>
> >>> a = (1,2)
> >>> b = (1,2)
> >>> a is b
> False
> >>> a = "12"
> >>> b = "12"
> >>> a is b
> True
Probably an accident of implementation. Consider:
>>> a = "1 2"
>>> b = "1" + " 2"
>>> a is b
False
and, for that matter:
>>> a = (1, 2)
>>> b = a
>>> a is b
True
Is there a reason that you care about this behavior?
More information about the Python-list
mailing list