I come to praise .join, not to bury it...
Tim Peters
tim.one at home.com
Thu Apr 12 02:05:15 EDT 2001
[Barry A. Warsaw]
> ...
> When phrased as:
>
> SPACE = ' '
> SPACE.join(somelist)
>
> it did, and still does, read very nicely to me,
Same here!
> so I included it in the string methods patch. Guido at least didn't
> hate it, so it made it in.
Your memory is correct here, but won't match Guido's. In Guido's mind, he
*first* said:
Funny, but it does seem right! Barry, go for it...
(on Mon Jun 14 10:46:37 1999). Your msg saying it was in the string methods
branch didn't get sent until Mon Jun 14 14:47:37 1999, and I'm sure Guido
can't imagine why it took you 4 hours to comply <wink>.
> ...
> As a function in the string module, the name `join' gives no clue
> as to whether the sequence comes first and the joining string
> comes second, or vice versa. I often got it wrong, or had to look
> it up. To me, that's a pretty big Pythonic sin, and I don't like
> it.
I don't think that's a coincidence: join was alone among the string module
functions in not taking a string argument *first* (similarly the re module
functions take "the regexp" first, etc). Since functions in the string
module were *conceptually* methods on strings, there was no choice but to
turn string.join(seq, sep) into sep.join(seq) <0.9 wink>.
"-".join("some random signoff string ly".split())+" y'rs - tim"
More information about the Python-list
mailing list