Is Perl *that* good?

Paramjit Oberoi p_s_oberoi at hotmail.com
Tue Apr 27 14:15:58 EDT 2004


>     Asun> Regex is much more 'immediate' in Perl.  
> 
> Sure, it's syntactically bound into the language.  There will always be an
> extra constant overhead to enable regular expressions in Python.  That

If only compiled regular expression objects allowed easy access to the
last match object, python regxes would become significantly more
convenient.  For example, today you have to write:

m = myregex.match(line)
if (m):
    xyz = m.group('xyz')

It would be much easier to do:

if myregex.match(line):
    xyz = myregex.lastm.group('xyz')

Having to introduce a new variable name for a match object just
muddles the code unnecessarily in common regex usage scenarios.

-param



More information about the Python-list mailing list