Hey there,

This is my first letter here, I'll try my best to explain the problem. First of all, I ran into this "problem" several times. I find str.split() a bit confusing. First of all, this is a corner case, but can happen like every day.

print("".split())  # returns []
print("".split(" "))  # returns ['']
print("".split("\t"))  # returns ['']
print("".split("\n"))  # returns ['']
print("".splitlines())  # returns []

So using split with or without a separator matters a lot, even when we use the same whitespace character split() uses. I think it is quite annoying. My idea is to return a list with an empty string in all cases mentioned above.

Best,
Gabor
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/NSGQC3CGVTCKHXWFJKPYNZXRZTD4LDFP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to