[Python-ideas] str.split() oddness

Nick Coghlan ncoghlan at gmail.com
Mon Feb 28 00:50:09 CET 2011


On Mon, Feb 28, 2011 at 8:18 AM, Mart Sõmermaa <mrts.pydev at gmail.com> wrote:
> Knowing that reasoning and the inconvenient special casing
> that it causes in actual code, would you still design split() as
> ''.split('b') == [''] today?

No, but that isn't really the question we need to ask. The more
important question is, given that it *does* behave this way now, is
changing it worth the inevitable hassle? How would we get there from
here without gratuitously breaking working programs?

So, even though I agree that Ruby's semantics are probably better in
this case, I don't see it as sufficiently important to justify the
breakage involved in fixing it.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list