metal metal...@gmail.com writes:
'11' + '1' == '111' is well known.
but it suprises me '11'+'1' IS '111'.
Don't be surprised. Rather, don't depend on implementation-dependent
behaviour, such as whether two objects that compare equal will or will
not have the same identity.
That behaviour
'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?
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Oct 29, 2009 at 5:43 PM, metal metal...@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 used to optimize performance
On Thu, Oct 29, 2009 at 8:43 PM, metal metal...@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
On 10月30日, 上午8时49分, Chris Rebert c...@rebertia.com wrote:
On Thu, Oct 29, 2009 at 5:43 PM, metal metal...@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
metal metal29a at gmail.com writes:
'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?
As other posters have pointed out, CPython does cache some small strings. In
this case
On Oct 30, 11:52 am, Benjamin Kaplan benjamin.kap...@case.edu wrote:
On Thu, Oct 29, 2009 at 8:43 PM, metal metal...@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
On 10月30日, 上午9时03分, Benjamin Peterson benja...@python.org wrote:
metal metal29a at gmail.com writes:
'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?
As other posters
Benjamin Peterson wrote:
metal metal29a at gmail.com writes:
'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?
As other posters have pointed out, CPython does cache some small