'11' + '1' is '111'?
benjamin.kaplan at case.edu
Fri Oct 30 01:52:37 CET 2009
On Thu, Oct 29, 2009 at 8:43 PM, metal <metal29a at gmail.com> wrote:
> '11' + '1' == '111' is well known.
> but it suprises me '11'+'1' IS '111'.
> Why? Obviously they are two differnt object.
> Is this special feature of imutable object?
It's an implementation detail of small strings without spaces and
small numbers. You're more likely to reuse those values, so Python
caches them. You shouldn't rely on it. It's not guaranteed to stay the
same between different implementations, or even different versions of
More information about the Python-list