Is Perl *that* good?

Ville Vainio ville at spammers.com
Tue Apr 27 04:31:37 EDT 2004


>>>>> "Asun" == Asun Friere <afriere at yahoo.co.uk> writes:

    Asun> Wouldn't you need to import the re module and compile the
    Asun> pattern first?  (And wouldn't you use 'search' rather than
    Asun> 'match'?)  And

I rarely compile regexps, just pass the string to the re functions.

    Asun> Regex is much more 'immediate' in Perl.  Probably the only

I mostly use re.findall and re.sub, which are every bit as immediate
as the perl counterparts. Match objects provide flexibility - if you
want immediacy, just define a utility function that removes the
flexibility and provides the convenience.

    Asun> time I would reach for Perl rather than for python is when I
    Asun> knew a task involved a lot of regex (and no object
    Asun> orientation).

If the task involves a lot of anything it can often be factored out to
some functions, and Python wins again. Perl5 is one of those languages
with no reason to exist anymore.

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list