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
Pike, JavaScript, Tcl, and Ruby), and it's a practical and useful
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 string:

>>> import re
>>> re.split('', 'abc')
['', 'a', 'b', 'c', '']

which gives us the chance to bikeshed on whether str.split should do the same.

(In case you're wondering, there _is_ an empty string (the delimiter) before the first character and after the last character.)
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to