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

Masklinn masklinn at masklinn.net
Tue Oct 26 18:33:41 CEST 2010


On 2010-10-26, at 18:09 , Steven D'Aprano wrote:
> Boris Borcic wrote:
>> And let's then propagate that notion, to a *coherent* definition of split that makes it as well a method on the separator.
> 
> Let's not.
> 
> Splitting is not something that you on the separator, it's something you do on the source string. I'm sure you wouldn't expect this:

Much as joining, that's a completely arbitrary decision. Python's take is that you split on a source and join on a separator, most APIs I've seen so far agree on the former but not on the latter.

And Python has an API which splits on the separator anyway: re.RegexObject is not a value you can provide to str.split() as far as I know (whereas in Ruby String#split can take a string or a regex indifferently, so it's coherent in that it always splits on the source string, never on the separator).


More information about the Python-ideas mailing list