[Python-Dev] Optimization

Xavier Morel python-dev at masklinn.net
Sun Oct 6 18:15:43 CEST 2013


On 2013-10-06, at 12:37 , Stephen J. Turnbull wrote:
> 
> For me, the point about string "+=" being efficient (sometimes) isn't
> that it is surprising compared to similar types, it's that it is
> surprising for any immutable sequence type.

It's clearly nitpicking, but ropes are immutable sequences with O(1)
concatenation. Clojure's vectors also have a more-or-less-O(1) append
(technically it's O(log32 n)) and one could implement a Python
version of them.


More information about the Python-Dev mailing list