M.-A. Lemburg wrote: > Tim Peters wrote: > >> If we were to do auto-str, it would be better to rewrite str.join() as >> a 1-pass algorithm, using the kind of "double allocated space as >> needed" gimmick unicode.join uses. It would be less efficient if >> auto-promotion to Unicode turns out to be required, but it's hard to >> measure how little I care about that; it might be faster if auto-str >> and Unicode promotion aren't needed (as only 1 pass would be needed). > > > FWIW, I'm -1 on doing auto-conversion using str()/unicode() in > .join(). I'm leaning that way myself. The 'auto-str' behaviour gives significant speed increases over the ''.join([str(x) for x in seq]) idiom, but the semantics become tricky when unicode, strings and things which are neither get mixed in the sequence. It also increases the complexity of the C code for the join methods. (Note that the version of auto-str I tried out *doesn't* actually mimic the list comprehension idiom - it tries to detect unicode and switch join implementations as appropriate, etc, etc.) Cheers, Nick.
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