[Python-3000] Automatically invoking str() in str.join()

Tim Peters tim.peters at gmail.com
Fri Apr 28 04:41:59 CEST 2006


[Alex Martelli, suggests that a functional join's default
 separator be the empty string]
>> Rationale: an emptystring joiner is the most frequent cases, but
>> several others (space, newline, space-comma, ...) occur often enough
>> to be worth allowing the joiner to be optionally specified.

[Barry Warsaw]
> If I look at the ones I write a lot it's emptystring, space, newline,
> comma-space and the Unicode versions of them occasionally.  There are
> others, but those are probably the majority of them.  I'm not sure what
> that tells us, except that I don't think there's an obvious default.
> You could probably argue for the emptystring just as well as for the
> space.

The existing string.join's default is a space, and-- back when that
was the only way to join() --I remember that suprised me about half,
and only half, the time I used it <0.5 wink>.  This really isn't like
split(), where split-on-whitespace is overwhelmingly most common.  In
the absence of an obvious default, better not to supply a default at
all.


More information about the Python-3000 mailing list