[Tutor] Regex's and "best practice"
Carl D Cravens
raven at phoenyx.net
Sun Nov 23 13:50:41 EST 2003
On Sat, 22 Nov 2003, Gerrit Holl wrote:
> You may want to use an entirely different approach to the problem.
> You don't need regular expressions at all. A number of high-level
> libraries are available for this problem: the mailbox module,
> the email module, e.g.
Yes, but that avoids the point of the exercise... to convert one of my
Perl scripts to Python to see how they compare.
I wrote the original script back in '86 on Perl 4. I don't think there
were any public mail libraries (modules didn't exist with Perl 4) at the
time, or I'd have just taken that approach with the Perl script as well.
> What you are doing, is translating Perl to Python. But it doesn't become
> Python then, it becomes translated Perl.
Which was the point of my original post... to see if I was missing
something obvious to the experienced Python coder.
But let's drop down a level and say I'm writing a mailbox module. I'd
probably still be using regexes, because trying to extract what I'm
looking for without them would be rather tedious.
--
Carl D Cravens (raven at phoenyx.net)
Dogs crawl under fences, Software crawls under Windows.
More information about the Tutor
mailing list