On Aug 18, 6:52 pm, "Jan Kaliszewski" <z...@chopin.edu.pl> wrote: > 19-08-2009 o 00:24:20 markscottwright <markscottwri...@gmail.com> wrote: > > > What's the correct way to turn an iterator over bytes into a string? > > This works, but, ewww: > > In [8]: "".join(iter("four score and seven years ago")) > > Out[8]: 'four score and seven years ago' > > But it is the correct way (and even recommended over s=s+t or s+=t, when > applicable > -- see: > http://docs.python.org/library/stdtypes.html#sequence-types-str-unico...). > > Cheers, > *j > > -- > Jan Kaliszewski (zuo) <z...@chopin.edu.pl>
Thanks Jan (and all other responders). I suppose I shouldn't be surprised - it's a known wart (http://wiki.python.org/moin/ PythonWarts), but it just looks so darn wrong. It is, as you point out, much faster than "better looking" alternatives, though - http://www.skymind.com/~ocrow/python_string/ -- http://mail.python.org/mailman/listinfo/python-list