join and split with empty delimiter
On 2019-07-18 00:24, Tim Daneliuk wrote:
> On 7/17/19 4:24 PM, Chris Angelico wrote:
>> Agreed. There are a number of other languages where splitting on an
>> empty delimiter simply fractures the string into characters (I checked
>> feature. +1.
> Not only that, it makes the language more symmetric/consistent. Put
> me down for +1 as well.
Since the fix in the re module in Python 3.7, it can split on an empty
>>> import re
>>> re.split('', 'abc')
['', 'a', 'b', 'c', '']
which gives us the chance to bikeshed on whether str.split should do the
(In case you're wondering, there _is_ an empty string (the delimiter)
before the first character and after the last character.)