On 01/11/2013 04:57 PM, Alex Gaynor wrote:
Hi Carl,The reason is that the dict has similar properties to a module dict: 1) keys are written only once 2) lookups are almost always by constant strings In typical usage a the groupindex dict is never mutated after its initial creation, and reads from it are by a precise name of a field, therefore by having it be a moduledict we can make re.group('name') be free. I'll go ahead and add a comment with this info.
does that mean that the dict (which is created during parsing) is stored on the regex object? If yes, that is the connection that I didn't understand. CF
Alex On Fri, Jan 11, 2013 at 2:17 AM, Carl Friedrich Bolz <[email protected] <mailto:[email protected]>> wrote: Hi Alex, I don't really understand the first change of this commit. Why is it a good idea to change the groupdict of the re parser to be a module dict? There are supposed to be "not too many" module dicts, because they are promoted on read. So I don't get why this is a sensible change. Would you please add a comment to the point where the module dict is instantiated why this is a good idea, and ideally also a test_pypy_c test. Cheers, Carl Friedrich -- "I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero
_______________________________________________ pypy-dev mailing list [email protected] http://mail.python.org/mailman/listinfo/pypy-dev
