I need an idea for practise!

Chris Angelico rosuav at gmail.com
Fri Jul 18 04:03:40 CEST 2014


On Fri, Jul 18, 2014 at 5:30 AM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
> But don't tell me for a *SECOND* that a colorizer, and a
> damn good one, can not be written utilizing regexps, because
> you're either wrong, or you're scared, or you're ignorant,
> or you're all of the above!

It might well be able to *utilize* regexps (as Terry showed, the one
in idlelib apparently does use them), but very few modern programming
languages can be fully and correctly defined within the limits of
regexp syntax. For instance, how can you recognize and thus colorize
assignments differently from name references, to distinguish between
"foo = 1" and "foo == 1"? Can you do that with a regexp? And there's
plenty more syntax that's tricky to define.

I might be wrong, and I might be ignorant, but I'm not scared. I know
what a regular expression can and can't do, and it's not fear to avoid
using them for jobs they can't do.

ChrisA



More information about the Python-list mailing list