[issue11773] Unicode compared using "is" results in abnormal behavior

Ezio Melotti report at bugs.python.org
Tue Apr 5 17:23:24 CEST 2011


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

The fact that "is" works in this way here is just an implementation detail.  If you want to compare strings use ==, "is" is used to verify if two variables refer to the same object or not.

>>> x = 100
>>> x is 100
True
>>> x = 1000
>>> x is 1000
False

----------
nosy: +ezio.melotti
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11773>
_______________________________________


More information about the Python-bugs-list mailing list