On 7/18/19 6:27 AM, Ben Bacarisse wrote: > One reason might be that str.split('') is not unambiguous. For example, > there's a case to be made that there is a '' delimiter at the start and > the end of the string as well as between letters. '' is a very special > delimiter because every string that gets joined using it includes it! > It's a wild version of ','.join(['a', 'b,c', 'd']).split(','). > > Of course str.split('') could be defined to work the way you expect, but > it's possible that the error is there to prompt the programmer to be > more explicit.
One thought I am having is that if the split is explicitly on '', then it is easy enough to use list(), but if it isn't a hard coded '', then the gotchas described aboveĀ are significant, that unless the join list was built of exactly 1 character strings, the split won't match, and that seems somewhat special case for a variable delimiter. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list