[Python-Dev] PEP 0008 confusion - here it is, but don't use it?
Tim Peters
tim.peters at gmail.com
Fri Aug 6 21:41:19 CEST 2004
>> For example, do not rely on CPython's efficient implementation
>> of in-place string concatenation for statements in the form a+=b or
>> a=a+b. Those statements run more slowly in Jython.
[Phillip J. Eby]
> Is that really true? I thought the last time this came up, somebody said
> that common Java implementations actually had special case code to speed up
> string concatenation.
Java != Jython. Java compilers know when they're dealing with
strings, and the Java spec defines '+' on strings in terms of
mutable-StringBuffer operations. Even so, the pragmatics of string
concatenation in Java are complex, well illustrated by this
excruciating "tech tip":
http://java.sun.com/developer/JDCTechTips/2002/tt0305.html
Jython is as blind as Python at compile-time about what the types are
in "a=a+b".
More information about the Python-Dev
mailing list