.join() question

Terry Reedy tjreedy at udel.edu
Wed Jul 9 16:10:23 EDT 2003


"drs" <drs at ecp.cc> wrote in message
news:eo_Oa.14415$BM.4645038 at newssrv26.news.prodigy.com...
> why does
>
> >>> ''.join(lst)
>
> not automatically do
>
> >>> ''.join([str(i) for i in lst])
>
> ?  That is, is there ever a time when one does not want .join to
make
> everything into a string?  This seems like reasonable default
behavior, but
> maybe I'm missing something?

If the members of lst are already str strings, this would be a waste
of time.  If they are unicode strings, this would be the wrong thing
to do.  Auto conversions are not Python's style.

Terry J. Reedy






More information about the Python-list mailing list