Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: a splitting headache (http://www.velocityreviews.com/forums/t702539-re-a-splitting-headache.html)

John Posner 10-22-2009 03:05 PM

Re: a splitting headache
 
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)

-John


Mensanator 10-22-2009 06:12 PM

Re: a splitting headache
 
On Oct 22, 10:05*am, John Posner <jjpos...@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



Paul Rudin 10-22-2009 06:22 PM

Re: a splitting headache
 
Mensanator <mensanator@aol.com> writes:

> No one ever considers making life easy for the user.


That's a bizarre assertion.


Mensanator 10-22-2009 10:46 PM

Re: a splitting headache
 
On Oct 22, 1:22*pm, Paul Rudin <paul.nos...@rudin.co.uk> wrote:
> Mensanator <mensana...@aol.com> writes:
> > No one ever considers making life easy for the user.

>
> That's a bizarre assertion.


I have a bad habit of doing that.


All times are GMT. The time now is 01:40 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.