A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/020987.html below:

[Python-Dev] "funny".split("")

[Python-Dev] "funny".split("")Andrew Koenig ark@research.att.com
12 Mar 2002 13:43:17 -0500
>> Why this?
>> I would expect

>> ['f','u','n','n','y']

Brian> Why wouldn't you expect this: 
Brian> ['', 'f', 'u', 'n', 'n', 'y', '']

For the same reason I wouldn't expect this:

['', '', 'f', 'u', 'n', 'n', 'y', '', '']

whatever that reason might be.  That is:  You give me a reason why
I should expect ['', 'f', 'u', 'n', 'n', 'y', ''] instead of
['f','u','n','n','y'] and I'll warrant that the same reason,
whatver it might happen to be, would argue also for
['', '', 'f', 'u', 'n', 'n', 'y', '', '']

If you're going to allow a null separator at all, then there has to be
a rule to choose one of the infinite number of possible return values.

One plausible rule, which would have the advantage of working the
same for empty and nonempty separators, is that no element of
the result can be equal to the separator.

-- 
Andrew Koenig, ark@research.att.com, http://www.research.att.com/info/ark



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4