On 5 June 2013 13:47, Andrews Medina <[email protected]> wrote:
> Hi, > > In the code below: > > >>>> x = "a" > >>>> b = "a" > >>>> x is b > False > It's more consistent than cpython - where the result of "x is b" is dependent on the length of the string : Python 2.7.3 (default, Apr 10 2013, 05:46:21) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> x="a"*20 >>> b="a"*20 >>> x is b True >>> x="a"*21 >>> b="a"*21 >>> x is b False Relying on "is" for comparing strings is generally a bug in your code waiting to be triggered. Michael.
_______________________________________________ pypy-dev mailing list [email protected] http://mail.python.org/mailman/listinfo/pypy-dev
