why cannot assign to function call

Benjamin Kaplan benjamin.kaplan at case.edu
Wed Jan 7 20:19:51 EST 2009


On Wed, Jan 7, 2009 at 7:22 PM, Terry Reedy <tjreedy at udel.edu> wrote:

> Joe Strout wrote:
>
>  That's not necessarily true.  If you have
>>
>>  a = "par" + "rot"
>>  b = "parrot"
>>
>> then, most likely (though it depends on how clever the compiler
>> optimizations are), there are two different string objects containing the
>> data "parrot".
>>
>
> >>> a='par'+'rot'
> >>> b='parrot'
> >>> a is b
> True


(this is on Mono. I don't know if the real .NET and/or newer versions of
IronPython do this differently)

IronPython 1.1 (1.1) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> a = "par" + "rot"
>>> b="parrot"
>>> a is b
False


>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090107/d33ef0e3/attachment.html>


More information about the Python-list mailing list