PyWart: Python regular expression syntax is not intuitive.

Ian Kelly ian.g.kelly at gmail.com
Wed Jan 25 18:36:45 EST 2012


On Wed, Jan 25, 2012 at 2:19 PM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
> I disagree here.
> Whist some people may be "die-hard" fans of the un-intuitive perl
> regex syntax, i believe many, if not exponentially MORE people would
> like to have a better alternative. Do i want to remove the current
> "well established" re module? No. But i would like to create a new
> regex module that is more pythonic. A regex module that we can be
> proud of. And just maybe, a regex module that "sets the bar" for all
> other regular expressions.

Compact regex notations are inherently unpythonic.  While your
reimplementation may be more intuitive to you, I don't think that it's
more pythonic at all.

> Window dressing is important Ian, if not, then shop owners would not
> continue to show displays in their shop windows. What does window
> dressing do exactly? It attracts the masses, and without the masses
> all merchants will eventually go out of buisness. Note: my argument
> HAS NOTHING to do with the number of folks programming python (or any
> language). The argument is focused on module sustainability in a
> community. Modules that are morbidly DIFFICULT to learn do not last.

Well, FWIW, I think that the current re module was easier for me to
learn than your version would have been, mainly because the re module
matches the syntax that I was already familiar with well before I
started using Python.  If you think you can do better, though, I
encourage you to actually write your regex module and put it up on
PyPI.

> I know about PyParsing but i believe we have room for PyParsing and a
> more Pythonic take on Perl style regular expressions. I don't see why
> we could not keep all three. Let the people decide what is best for
> them.

PyParsing produces recursive descent parsers.  It's an alternative to
regular expressions for a different class of parsing problems, not a
replacement, and so it's not particularly germane to this discussion.



More information about the Python-list mailing list