why cannot assign to function call

Terry Reedy tjreedy at udel.edu
Wed Jan 7 19:22:00 EST 2009


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




More information about the Python-list mailing list