On Friday, February 24, 2017 at 2:41:58 PM UTC-8, Erik wrote: > 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.
I was trying to understand the performance aspect, so idx lookup is faster than map, got it. -- https://mail.python.org/mailman/listinfo/python-list