[Python-Dev] PEP 0008 confusion - here it is, but don't use it?
"Martin v. Löwis"
martin at v.loewis.de
Fri Aug 6 22:07:46 CEST 2004
Skip Montanaro wrote:
>>From Raymond's checkin:
>
> Programming Recommendations
>
> - Code should be written in a way that does not disadvantage other
> implementations of Python (PyPy, Jython, IronPython, Pyrex, Psyco, and
> such). 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. In performance
> sensitive parts of the library, the ''.join() form should be used
> instead. This will assure that concatenation occurs in linear time
> across various implementations.
>
> I'm a bit confused. Why bother to speed up s+=t if we aren't supposed to
> use it?
Because it helps users who aren't aware of the problem, and use the
obvious approach. Developers of the standard libraries are supposed to
know, and use the "better, but non-obvious" technique.
Regards,
Martin
More information about the Python-Dev
mailing list