pySQLite Insert speed

Steve Holden steve at holdenweb.com
Tue Mar 4 09:50:16 EST 2008


Peter Otten wrote:
> Steve Holden wrote:
> 
>> What I will repeat, however, is that while there is a *slight*
>> difference is semantics between
>>
>> s = "some string"
>> s1 = s
>>
>> and
>>
>> s = "some string"
>> s1 = copy.copy(s)
>>
>> that difference is only to ensure that s and s1 point to different
>> copies of the same string in the latter case, whereas in the former case
>> s and s1 point to the same string.
> 
> No, both "point" to the same string:
> 
>>>> import copy
>>>> s = "some string"
>>>> s1 = s
>>>> s1 is s
> True
>>>> s2 = copy.copy(s)
>>>> s2 is s
> True
> 
> copy.copy() is just an expensive no-op here.
> 
I suppose wiht strings being immutable there is no need for copy.copy() 
to actually return anything other than its argument for a string. Thanks 
for pointing that out.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list