It's never been clear to me why join
and split
have the opposite syntax from each other in Python. As in the below example:
some_list = ['a', 'b', 'c']
some_str = ' '.join(some_list)
some_str = 'a.b.c.'
some_list = some_str.split('.')
Why isn't it some_list.join(' ')
, or conversely, '.'.split(some_str)
? Is there a historical reason for these two syntaxes being different, or is it because of something you can do with one syntax that you can't with the other?