On 24/02/17 22:18, kar wrote:
Thanks, what is the idea behind storing the keys and values in a list, I assume looking up for a value in a map is faster getting the value from the list.
What do you not understand? MRAB's extensive comments explain what is being done and why.
In summary, the keys and values are put into lists so that the keys can be given an explicit order for the re.compile() and then the subsequent lookup when a match is found is via a numeric index (which is even faster for a list than a key lookup is for a dict (map)).
E. -- https://mail.python.org/mailman/listinfo/python-list