Skip to content

''.split() != ''.split(' ') #80

Closed
Closed
@koddo

Description

@koddo

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.

>>> ''.split() != ''.split(' ')
>>> True

>>> ''.split() 
>>> []

>>> ''.split(' ')
>>> ['']

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions