[Tutor] Python RE uses DFA or NFA for string check?

Kent Johnson kent37 at tds.net
Tue Jan 10 16:14:26 CET 2006


Intercodes wrote:
> Hello everyone,
> 
> This question is just out of curiosity. I am working with this dragon 
> book. From what I have learnt so far, RE uses either NFA or DFA to check 
> whether the string is accepted or not. (Correct?)
> 
> So what does the Python's RE module use to check the correctness of the 
> string, NFA or DFA?

You could look at the source. A little digging shows that REs are parsed 
by sre_parse.parse() which is in Python24\Lib\sre_parse.py on my computer.

Kent



More information about the Tutor mailing list