Re: Program inefficiency?
- From: Pablo Ziliani <pablo@xxxxxxxxxxxxx>
- Date: Sat, 29 Sep 2007 14:55:53 -0300
thebjorn wrote:
On Sep 29, 5:22 pm, hall.j...@xxxxxxxxx wrote:
I wrote the following simple program to loop through our help files
and fix some errors (in case you can't see the subtle RE search that's
happening, we're replacing spaces in bookmarks with _'s)
(...)
Ugh, that was entirely too many regexps for my taste :-)
How about something like:
def attr_ndx_iter(txt, attribute):
(...)
def substr_map(txt, indices, fn):
(...)
def transform(s):
(...)
def zap_spaces(txt, *attributes):
(...)
def mass_replace():
(...)
Oh yeah, now it's clear as mud.
I do think that the whole program shouldn't take more than 10 lines of code using one sensible regex (impossible to define without knowing the real input and output formats).
And (sorry to tell) I'm convinced this is a problem for regexes, in spite of anybody's personal taste.
Pablo
.
- Follow-Ups:
- Re: Program inefficiency?
- From: hall . jeff
- Re: Program inefficiency?
- From: thebjorn
- Re: Program inefficiency?
- References:
- Program inefficiency?
- From: hall . jeff
- Re: Program inefficiency?
- From: thebjorn
- Program inefficiency?
- Prev by Date: xml modifications
- Next by Date: Re: sorteddict [was a PEP proposal, but isn't anymore!]
- Previous by thread: Re: Program inefficiency?
- Next by thread: Re: Program inefficiency?
- Index(es):
Relevant Pages
|