[Pyrex] Speeding up custom string lowercasing with Pyrex

skip at pobox.com skip at pobox.com
Wed Oct 31 14:57:25 CET 2007


    Bob> The "to = to + c" line strikes me as not being efficient. Python
    Bob> creates a new copy of "to" every time it appends "c" to the
    Bob> end. One common, pure-python fix is:

    Bob> to = []
    Bob> for ...
    Bob>    ...
    Bob>    to.append( c )
    Bob> return "".join(to)

This common case was sped up in Python 2.5.

Skip



More information about the Pyrex mailing list