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

Carl M. Johnson cmjohnson.mailinglist at gmail.com
Wed Oct 27 13:22:41 CEST 2010

The downside of flipping the object and parameter of split is that
there's no clear thing to translate "blah\tblah\nblah".split() ==>
['blah', 'blah', 'blah'] into. None.split(string) is crazy talk. Then
again, the case can be made that split() doesn't behave like the other
splits (it drops empty segments; it treats all whitespace the same),
so maybe it shouldn't have the same name as the normal kind of split.

I do think that it might be convenient to be able to do this:

commasplit = ', '.divide #If we're going to imagine this, we should
probably use a different name than "split"
list1 = commasplit(string1)
list2 = commasplit(string2)

The same way that one can do:

commajoin = ', '.join
string1 = commajoin(list1)
string2 = commajoin(list2)

But the convention is too old and the advantage is too slight to
bother with sort of bikeshedding now. Save it for when you design a
new language to replace Python. :-)

-- Carl

More information about the Python-ideas mailing list