[Python-Dev] Why Foo is better than Baz
Tim Peters
tim_one at email.msn.com
Tue May 4 07:16:17 CEST 1999
[Guido & Andrew on Tcl's new regexp code]
> I'm sure that if it's good code, we'll find a way. Perhaps a more
> interesting question is whether it is Perl5 compatible. I contacted
> Henry Spencer at the time and he was willing to let us use his code.
Haven't looked at the code, but did read the manpage just now:
http://www.scriptics.com/man/tcl8.1/TclCmd/regexp.htm
WRT Perl5 compatibility, it sez:
Incompatibilities of note include `\b', `\B', the lack of special
treatment for a trailing newline, the addition of complemented
bracket expressions to the things affected by newline-sensitive
matching, the restrictions on parentheses and back references in
lookahead constraints, and the longest/shortest-match (rather than
first-match) matching semantics.
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!
otoh-it's-potentially-very-much-faster-ly y'rs - tim
More information about the Python-Dev
mailing list