On Tue, 3 Oct 2017 10:21:55 -0400 Barry Warsaw <ba...@python.org> wrote: > On Oct 3, 2017, at 01:41, Serhiy Storchaka <storch...@gmail.com> wrote: > > > > 03.10.17 06:29, INADA Naoki пише: > >> More optimization can be done with implementing sre_parse and sre_compile > >> in C. > >> But I have no time for it in this year. > > > > And please don't do this! This would make maintaining the re module hard. > > The performance of the compiler is less important than correctness and > > performance of matching and searching. > > What if the compiler could recognize constant arguments to re.compile() and > do the regex compilation at that point? You’d need a way to represent the > precompiled regex in the bytecode, and it would technically be a semantic > change since regex problems would be discovered at compilation time instead > of runtime - but that might be a good thing. You could also make that an > optimization flag for opt-in, or a flag to allow opt out.
We need a regex literal! With bytes, formatted, and bytes formatted variants. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com