[Python-Dev] Tcl 8.1's regexp code (was RE: [Python-Dev] Why Foo is better than Baz)

Barry A. Warsaw bwarsaw at cnri.reston.va.us
Wed May 5 16:55:40 CEST 1999


>>>>> "TP" == Tim Peters <tim_one at email.msn.com> writes:

    TP> Over the long run, moving to a DFA locks Python out of the
    TP> directions Perl is *moving*, namely embedding all sorts of
    TP> runtime gimmicks in regexps that exploit knowing the "state of
    TP> the match so far".  DFAs don't work that way.  I don't mind
    TP> losing those possibilities, because I think the regexp
    TP> sublanguage is strained beyond its limits already.  But that's
    TP> a decision with Big Consequences, so deserves some thought.

I know zip about the internals of the various regexp package.  But as
far as the Python level interface, would it be feasible to support
both as underlying regexp engines underneath re.py?  The idea would be 
that you'd add an extra flag (re.PERL / re.TCL ?  re.DFA / re.NFA ?
re.POSIX / re.USEFUL ? :-) that would select the engine and compiler.
Then all the rest of the magic happens behind the scenes, with
appropriate exceptions thrown if there are syntax mismatches in the
regexp that can't be worked around by preprocessors, etc.

Or would that be more confusing than yet another different regexp
module?

-Barry




More information about the Python-Dev mailing list