Author belopolsky
Recipients belopolsky, benjamin.peterson, donlorenzo, rsc, zanella
Date 2008-05-08.15:08:47
SpamBayes Score 0.000380033
Marked as misclassified No
Message-id <d38f5330805080808x267f7131p8a69507694f6060e@mail.gmail.com>
In-reply-to <20080508143906.D71FF1E8C55@holo.morphisms.net>
Content
On Thu, May 8, 2008 at 10:36 AM, Russ Cox <report@bugs.python.org> wrote:
..
>  The title of this issue (#2650) is "re.escape should not escape underscore",
>  not "re.escape is too slow and too easy to read".
>

Neither does the title say "re.escape should only escape
.^$*+?{}[]\|()".  I reviewed the patch rather than its conformance
with the title.  (BTW, the patch does not update documentation in
Doc/library/re.rst.)

>  If you have an actual, measured performance problem with re.escape,
>  please open a new issue with numbers to back it up.
>  That's not what this one is about.

You don't need to get so defensive.  I did not raise a performance
problem, I was simply responding to Rafael's "AFAIK the lookup on
dictionaries is faster than on lists" comment.  I did not say that you
*should* rewrite your patch the way I suggested, only that you *can*
use new language features to simplify the code.

In any case, I am -0 on the patch.  The current documentation says:

"""
escape(string)

   Return *string* with all non-alphanumerics backslashed; this is useful if you
   want to match an arbitrary literal string that may have regular expression
   metacharacters in it.

"""

and the current implementation serves the intended use case well.  I
did not see a compelling use case presented for the change.  On the
downside, since there is no mechanism to assure that _special indeed
contains all re metacharacters, it may present a maintenance problem
if additional metacharacters are added in the future.
History
Date User Action Args
2008-05-08 15:08:52belopolskysetspambayes_score: 0.000380033 -> 0.000380033
recipients: + belopolsky, rsc, benjamin.peterson, zanella, donlorenzo
2008-05-08 15:08:51belopolskylinkissue2650 messages
2008-05-08 15:08:48belopolskycreate