-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
''.split() != ''.split(' ') #80
Comments
I don't think so, the docs are pretty clear about what happens when you don't supply a delimiter. |
umm, I think this can be added to our "Minor ones" collection (I wasn't expecting it to return But let's wait for more opinions on this... |
I don't think there is any inconsistency, the split docs clearly explains what happens when we pass an empty string and what happens when you pass an empty string with a delimiter. |
I've just read the stackoverflow answer, and I'm not convinced. I don't understand why with no
To me this should apply to both algorithms. |
And there's another edge case when a string only consists of whitespace. Should |
I'm sorry for spamming, I think I get it now. The non-obvious thing about this function is when there's no So the edge case when the string is empty works like this: I'd have two functions with carefully chosen names than having one function with behavior like this. |
@koddo Added, thanks for the suggestion :) You can check the above commit and let me know if something's incorrect or missing. |
Hello. Does the following qualify?
When you split an empty string without arguments, you get an empty list.
When you specify a separator, you get a non-empty list, see below.
More of an inconsistency than a wtf, but nevertheless I'd like to share this.
I wonder why it works this way.
The text was updated successfully, but these errors were encountered: