I come to praise .join, not to bury it...

Delaney, Timothy tdelaney at avaya.com
Sun Mar 4 20:45:06 EST 2001


> I have not heard ANY _technical_ arguments opposed to
> this last time the discussion went around -- nothing but
> vague aesthetic, "it should be the other way", "I find it
> ugly" kind of complaints.  Unless and until further notice,
> then, I class these together with the complaints of people
> who dislike 0-based indexing, on similar vague bases -- as
> 0-based indexing _works_ better than 1-based, then, for
> me, it is a superior choice.  Aesthetics is in the eye of the

I truly have no complaints with the technical merits of ''.join().

However, I have *severe* complaints with the aesthetics and consistency.
Quite simply, the way we look at things tends to be

"result" = "thing to be acted on to get the result" modified by "thing which
does the action"

This is consistently followed in the standard python libraries in almost all
cases ... but ''.join() is a glaring inconsistency. As a result, it seems
unintuitive and ugly.

This is why I prefer string.join(sequence, string). It is now syntactic
sugar for the above, and documented as such. However, it is *important*
syntactic sugar. It is known that the method is called polymorphically on
the second argument (a standard interface) but it feels that it is the first
argument which is the basis for the expression. This remains consistent with
the rest of the standard libraries.

OTOH, I suggest an alternative syntax ...

(sequence)join.''

There. Everyone should be happy with that ;)

Tim Delaney
Avaya Australia
+61 2 9352 9079

All recipient(s) of this email have permission to forward or reply to this
email, quoting this email in full or in part.




More information about the Python-list mailing list