[Python-checkins] python/nondist/peps pep-0008.txt,1.24,1.25
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Fri Aug 6 20:47:28 CEST 2004
Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24377
Modified Files:
pep-0008.txt
Log Message:
SF patch #980695: efficient string concatenation
(Original patch by Armin Rigo).
Index: pep-0008.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0008.txt,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** pep-0008.txt 30 Mar 2004 01:12:22 -0000 1.24
--- pep-0008.txt 6 Aug 2004 18:47:26 -0000 1.25
***************
*** 522,525 ****
--- 522,534 ----
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.
+
- Comparisons to singletons like None should always be done with
'is' or 'is not'. Also, beware of writing "if x" when you
More information about the Python-checkins
mailing list