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

Steve Holden sholden at holdenweb.com
Mon Mar 5 11:28:57 EST 2001


"Delaney, Timothy" <tdelaney at avaya.com> wrote in message
news:mailman.983756766.27347.python-list at python.org...
> > 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 ;)
>
See the FAQ: I have added question 4.96. "Why is join() a string method when
I'm really joining the elements of a (list, tuple, sequence)?" which )for
some value of "summarises") summarises the discussions on this one. Please
feel free to shoot it down in flames. Just trying to keep the bandwidth
down.

done-my-good-deed-for-the-day-ly y'rs  - steve

PS: Have a good time at the conference while I'm teaching Unix security in
New Mexico!





More information about the Python-list mailing list