[Python-ideas] textFromMap(seq , map=None , sep='' , ldelim='', rdelim='')

Nick Coghlan ncoghlan at gmail.com
Wed Oct 27 00:28:07 CEST 2010

On Wed, Oct 27, 2010 at 12:24 AM, Boris Borcic <bborcic at gmail.com> wrote:
> On Tue, Oct 26, 2010 at 2:35 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> But split only makes sense for strings, not arbitrary sequences. It's
>> the other way around for join.
> I don't feel your "the other way around" makes clear sense.

Indeed, I realised my comment was slightly ambigous some time after I
posted it. "the other way around" refers to the English sentence, not
to the Python parameter order (i.e. join makes sense for arbitrary
sequences, not just strings).

If you're looking for the relevant piece of the Zen here, it's
"practicality beats purity". string.join used to be used primarily as
a function, but people had trouble remembering the parameter order.
Locking it in as a str method on the separator made the argument order
easier to remember at the cost of making it somewhat unintuitive to
learn in the first place (making it a method of the sequence being
joined was not an option, since join accepts arbitrary iterables).
Absolutely nothing has changed in the intervening years to affect the
rationale of that decision, so you can rail against it all you want
(with some justification) but you aren't going to change it.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list