Matt Chaput <m...@whoosh.ca> added the comment:

Yes, it's an optimization of my code, not the regex, as I said. Believe me, 
it's not premature. I've listed two general use cases for the two methods. To 
me it seems obvious that having to test a large number of regexes against a 
string, and having to test a single regex against a large number of strings, 
are two very common programming tasks, and they could both be speeded up quite 
a bit using these methods.

As of now my parsing code and other code such as PyParsing are resorting to 
hacks like requiring the user to manually specify the possible first chars of a 
regex at configuration. With the hacks, the code can be hundreds of times 
faster. But the hacks are error-prone and should be unnecessary. 

The PCRE library implements at least the "first char" functionality, and a lot 
more regex introspection that would be useful, through its pcre_fullinfo() 
function.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12870>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to