string.join() syntax quirky?

Sean 'Shaleh' Perry shalehperry at home.com
Thu Nov 22 14:04:45 EST 2001


> 
>     This works fine, but it seems syntactically backwards to me:
> 
># s = l.join("")
> 
> makes much more sense to me. The thingy I want to do something to is my
> list. I am just trying to learn Python, so no doubt there will be some
> Python things I will just have to get used to, but is there a logical
> reason why it was implemented as a string method rather than a list
> method? Does it seem backwards to you or does it make intuitive sense to
> you? Comments? (other than of the "it's moot" flavor)
> 

Yep, this has been pounded before.  I actually liked it better when it was
string.join(s, l), but oh well.

The problem here is that "".join(l) works for ANY sequence.  l.join() would
have to be reimplemented for every sequence like object.




More information about the Python-list mailing list