[Python-Dev] Why Foo is better than Baz

Guido van Rossum guido at CNRI.Reston.VA.US
Tue May 4 14:26:04 CEST 1999


[Tim]
> So some gratuitous differences, and maybe a killer:  Guido hasn't had much
> kind to say about "longest" (aka POSIX) matching semantics.
> 
> An example from the page:
> 
>     (week|wee)(night|knights)
>     matches all ten characters of `weeknights'
> 
> which means it matched 'wee' and 'knights'; Python/Perl match 'week' and
> 'night'.
> 
> It's the *natural* semantics if Andrew's suspicion that it's compiling a DFA
> is correct; indeed, it's a pain to get that behavior any other way!

Possibly contradicting what I once said about DFAs (I have no idea
what I said any more :-): I think we shouldn't be hung up about the
subtleties of DFA vs. NFA; for most people, the Perl-compatibility
simply means that they can use the same metacharacters.  My guess is
that people don'y so much translate long Perl regexp's to Python but
simply transport their (always incomplete -- Larry Wall *wants* it
that way :-) knowledge of Perl regexps to Python.  My meta-guess is
that this is also Henry Spencer's and John Ousterhout's guess.  As for
Larry Wall, I guess he really doesn't care :-)

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-Dev mailing list