polymorphjsm &c (was Re: I come to praise .join, not to bury it...)

Carel Fellinger cfelling at iae.nl
Thu Mar 8 15:38:43 EST 2001


Alex Martelli <aleaxit at yahoo.com> wrote:
...some code corrections sniped

So much for testing then:) I expected some errors, got them, so I was
pleased.  And forget to really look at the errors:(

> but neither do you get what you want, because a.split(b) works
> irregularly...:

>     -- if a is a re object, or if it's module-object os.path,
>         then string b is split using splitter-object a
>     -- if a is a string object (including a Unicode string),
>         then string a is split using splitter-object b (which
>         must also be a string)

Ops, overlooked this one completely.  Should have known better though
having been bit by it in the past.

> I.e., the semantics are backwards in the two cases, alas.

Yes, and one is wrong according to your arguments on joiner.join:)

Though I agree with what you hinted at in an other post, that much of
the gripes over it have to do with the fact that join is Intransitive
and Transitive as well.  Would we choose a different word for it the
reading of joiner.join(to_be_joined) would be clear without us needing
to spell it out like here.  At least, that's what I tent to think now.
[[ besides in dutch this ambiguity gets resolved nicely, as mostly the
   intransitive form has an extra 'zich' (self) attached ]]

-- 
groetjes, carel



More information about the Python-list mailing list