[Python-ideas] list as parameter for the split function

Chris Barker chris.barker at noaa.gov
Tue Sep 29 17:30:45 CEST 2015


On Mon, Sep 28, 2015 at 8:43 PM, Steven D'Aprano <steve at pearwood.info>
wrote:

> (3) Using a regular expression is probably the "right" answer, at least
> from a comp sci theorectical perspective. This is precisely the sort of
> thing that regexes are designed for. Unfortunately, regex syntax is
> itself a programming language[1], and a particularly cryptic and
> unforgiving one, so even quite experienced coders can have trouble.
>

indeed -- we all know the old maxim:

"I had a problem, and thought "I know, I'll use regular expressions" -- now
I have two problems.

And the Python "obvious way to do it" has always been for simple string
manipulation, see if what you need is in a string method before you bring
out the big guns of REs

After all, if "use REs" was the answer to simple string manipulation
problems, the string object would have a lot fewer methods.

So: I've frequently had this use-case, too -- it would be a nice
enhancement that would had substantial utility to strings. Whether it used
an re under the hood or not should be an implementation detail.

-CHB

-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150929/f9447aa0/attachment-0001.html>


More information about the Python-ideas mailing list