[Pyrex] Speeding up custom string lowercasing with Pyrex
Stefan Behnel
stefan_ml at behnel.de
Wed Oct 31 15:21:13 CET 2007
Bob Van Zant wrote:
> On 10/31/07 7:27 PM, "skip at pobox.com" <skip at pobox.com> wrote:
>
>> 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.
>
> The += part was fixed up?
Yes.
Stefan
More information about the Pyrex
mailing list