[Python-ideas] Exposing regular expression bytecode

Chris Angelico rosuav at gmail.com
Tue Feb 16 04:22:38 EST 2016


On Tue, Feb 16, 2016 at 6:42 PM, Jonathan Goble <jcgoble3 at gmail.com> wrote:
> I understand, and probably shouldn't have added that last paragraph,
> but it is frustrating to argue against something and then have the
> same thing thrown back at me without counter-argument. I guess I'm
> just annoyed that I haven't gotten any substantive comments regarding
> the usefulness of it, while other threads are highly active (e.g.
> generator unpacking). Perhaps I should be a bit more patient; patience
> has never been one of my positive qualities. :-P
>

For what it's worth, I read your post with interest, but didn't have
anything substantive to reply - mainly because I don't use regexes
much. But it would be rather cool to be able to decompile a regex.
Imagine a regex pretty-printer: compile an arbitrary string, and if
it's a valid regex, decompile it to a valid source code form, using
re.VERBOSE. That could help _hugely_ with debugging, if the trick can
be pulled off.

ChrisA


More information about the Python-ideas mailing list