Python and regexp efficiency.. again.. :)

Tony J Ibbs (Tibs) tony at lsl.co.uk
Tue Dec 14 05:02:24 EST 1999


Marc-Andre Lemburg suggested that Markus Stenberg use mxTextTools.

Markus replied that "the tagging language seemed to be somewhat limited
compared to regexps".

Marc-Andre explained his view on why this is not so, which I've snipped.

Personally, I'm biassed because I don't like regular expressions, except for
*very* simple tasks. My view is that mxTextTools provides something much
closer to a programming language for handling text matching, with several of
the traditional control structures that one finds in programming languages
built in - that's why the metalanguage *looks like* a programming language.
I think that the comparison of mxTextTools and regular expressions is
somewhat similar to that of Python and Perl - one is a general tool, rather
more verbose but definitely more elegant, and the other is more specialised,
provides more shortcuts "built in", and is ever so much easier to write in
an obfuscated manner.

It also depends what you want to do. I use mxTextTools rather than work my
way round traditional parsers and having to deal with parse trees (an
inability to work with references (to references (to references...)) in
languages like C without lots of little diagrams has given me a 'fear' of
tree structures which is not really appropriate in Python!) and it's neat
stuff.

Tibs
--
Tony J Ibbs (Tibs)      http://www.tibsnjoan.demon.co.uk/
"How fleeting are all human passions compared with the massive
continuity of ducks." - Dorothy L. Sayers, "Gaudy Night"
My views! Mine! Mine! (Unless Laser-Scan ask nicely to borrow them.)






More information about the Python-list mailing list