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

Steven D'Aprano steve at pearwood.info
Tue Oct 26 18:09:23 CEST 2010


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:

":".find("key:value") => 3

Nor should we expect this:

":".split("key:value") => ["key", "value"]

You perform a search on the source string, not the target substring. Likewise you split the source string, not the separator.

-- Steven



More information about the Python-ideas mailing list