Speed of string += string

Courageous jkraska at san.rr.com
Tue Apr 15 22:55:46 EDT 2003


>>But is that /guaranteed/ (as it is with STL), or does it just happen to
>>be that way with the current implementation (however unlikely it is to
>>change)?

>Both, sort of.  Python uses dicts internally; you can rely on any
>changes to achieve roughly equivalent or better performance guarantees.

Yeah, but dictionaries are only /guaranteed/ to scale O(N). 'Course,
I recall that a fairly good mathematician or two seems to think that
amortized times are fine; these /tend/ to scale O(1). It doesn't hurt
at all that Python's dictionary implementation has been tuned and
tested more than just about any dictionary implementation in any
production environment anywhere*. :)

My interpretation of his question makes me wonder how he came to believe
that Guido and Tim are on a standards committee, dictating how the host
of various and sundry Python compiler developers will design Python
implementations. Or perhaps he fears that someone will steal Python from
us and do something evil, like replace dict with a red-black tree. :-)

performed-an-extensive-analysis-twenty-years-from-now-and-mailed-
it-backwards-through-time-ly yrs*

C//





More information about the Python-list mailing list