[docs] [issue10178] PEP 378 uses replace where translate may work better

Raymond Hettinger report at bugs.python.org
Sat Oct 23 23:55:10 CEST 2010


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

Sorry, the text needs to stand as-is.
It is supposed to be a hint of what can be done,
nothing more.

The technique of t=x; x=y; y=t is somewhat basic
and has general applicability -- there's nothing
"complex" about it.   Also, for short strings 
such as the one in the example, the translate 
approach is slower unless the used in a loop
where the translation table is already built.

BTW, the PEP itself is not primary documentation
for users.  It is meant to document the design
discussion only.  

Feel free to post your recipe on ASPN or on
the newsgroup.

----------
resolution:  -> rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10178>
_______________________________________


More information about the docs mailing list