a splitting headache

Mensanator mensanator at aol.com
Thu Oct 22 14:12:28 EDT 2009


On Oct 22, 10:05 am, John Posner <jjpos... at optimum.net> wrote:
> Carl Banks wrote:
>
> <snip>
>
> > s.split() and s.split(sep) do different things, and there is no string
> > sep that can make s.split(sep) behave like s.split().  That's not
> > unheard of but it does go against our typical expectations.  It would
> > have been a better library design if s.split() and s.split(sep) were
> > different methods.
>
> It looks like they *were* different methods. The Oct 1996 edition of
> "Programming Python" (O'Reilly & Assoc.), based on Python 1.3, describes
> two separate functions in the "string" module in Chapter 16:
>
>  string.split()
>  string.splitfields(delim)

That's interesting. If string.splitfields(delim) was equivalent to
str.split(sep), it would have been useful to add the phrase
"str.split(sep) is equivalent to the old string.splitfields(delim)
which no longer exists." to the docs. That way, a search on
"splitfields" would direct the user to str.split(sep) rather than
simply throw a dialog box saying "No topics found". No one ever
considers making life easy for the user.

>
> -John




More information about the Python-list mailing list