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

Boris Borcic bborcic at gmail.com
Tue Oct 26 19:59:17 CEST 2010


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:
>
> ":".find("key:value")
> => 3

To be honest, my test for this type of questions is how likely I find myself 
using the bound method outside of immediate method call syntax, and I'd say 
having a specialized callable that will find specific content in whatever future 
argument, is more likely than the converse callable that will find occurences of 
whatever future argument in a fixed string. YMMV

>
> 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.

To me, this sounds like giving too much weight to english language intuition. 
What really counts is not how it gets to be said in good english, but rather - 
what's the variable/object/value that, in the context of the action, tends to be 
the most stable focus of attention. And remember that most speakers of E as a 
second language, never become fully comfortable with E prepositions.

Cheers, BB




More information about the Python-ideas mailing list