why cannot assign to function call

Terry Reedy tjreedy at udel.edu
Thu Jan 8 01:22:00 CET 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