[Python-Dev] PEP 0008 confusion - here it is, but don't use it?
Raymond Hettinger
python at rcn.com
Fri Aug 6 09:32:21 CEST 2004
More information about the Python-Dev mailing list
Fri Aug 6 09:32:21 CEST 2004
- Previous message: [Python-Dev] PEP 0008 confusion - here it is, but don't use it?
- Next message: [Python-Dev] PEP 0008 confusion - here it is, but don't use it?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> 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
- Previous message: [Python-Dev] PEP 0008 confusion - here it is, but don't use it?
- Next message: [Python-Dev] PEP 0008 confusion - here it is, but don't use it?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list