PyWart: Python regular expression syntax is not intuitive.

Duncan Booth duncan.booth at invalid.invalid
Wed Jan 25 16:41:23 EST 2012

Rick Johnson <rantingrickjohnson at> wrote:

> On Jan 25, 2:17ÿpm, Ian Kelly < at> wrote:
>> On Wed, Jan 25, 2012 at 10:16 AM, Rick Johnson
>> Did you read the very first sentence of the re module documentation?
>> "This module provides regular expression matching operations *similar
>> to those found in Perl*" (my emphasis). ÿThe goal here is
>> compatibility with existing RE syntaxes, not readability. ÿPerl uses
>> the (?...) syntax, so the re module does too.
> @Duncan and Ian:
> Did you not read the title of my post? :o) " Python regular expression
> syntax is not intuitive." While i understand WHERE the syntax
> orientations from, that fact does not solve the problem. The syntax is
> not intuitive, and Python should ALWAYS be intuitive! We should always
> borrow ideas from anyone (even our enemies) when those ideas support
> our ideology. Perl style regexes are not Pythonic. They violate our
> philosophy in too many places.
Or we could implement de-facto standards where they exist.


Duncan Booth

More information about the Python-list mailing list