> I'm a bit confused. Why bother to speed up s+=t if we aren't supposed to > use it? In fact, it is does occur all over the place (esp. in newbie code) so it ought to run as fast as possible or least not be a total disaster. OTOH, library code gets run on various implementations of Python and it would be a mistake to change any library code from ''.join() and have it start performing badly on other implementations. That was essentially the only argument against the patch which is otherwise a pure win. On a side note, the += optimization only works if there is space (fragmentationwise, not total memory) to resize a string in-place. While this is usually true, ''.join() always runs in linear time. Also, ''.join() doesn't run through the eval-loop. IOW, notwithstanding cross-implementation performance, ''.join() is usually a better choice in performance sensitive code. The goal of the patch is not to change coding styles. Rather, the goal is to have it hurt less when you coded += anyways. Raymond
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4