On Tue, 29 Jun 2010 08:41:03 -0400, Roy Smith wrote: >> > And what about regular expressions? >> >> What about them? As the saying goes: >> >> Some people, when confronted with a problem, think >> "I know, I'll use regular expressions." >> Now they have two problems. > > That's silly. RE is a good tool. Like all good tools, it is the right > tool for some jobs and the wrong tool for others.
"When all you have is a hammer, everything looks like a nail" ;) Except, REs are more like a turbocharged angle grinder: bloody dangerous in the hands of a novice. [I was going to say "hole hawg", but then realised that most of my post would be a quotation explaining it. The reference is to Neal Stephenson's essay "In the Beginning was the Command Line": <http://www.cryptonomicon.com/beginning.html>] > I've noticed over the years a significant anti-RE sentiment in the > Python community. IMHO, the sentiment isn't so much against REs per se, but against excessive or inappropriate use. Apart from making it easy to write illegible code, they also make it easy to write code that "mostly sort-of works" but somewhat harder to write code which is actually correct. It doesn't help that questions on REs often start out by stating a problem for which REs are inappropriate, e.g. parsing a context-free (or higher) language, and in the same sentence indicate the the poster is already predisposed to using REs. -- http://mail.python.org/mailman/listinfo/python-list