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.

Alex

On Fri, Jan 11, 2013 at 2:17 AM, Carl Friedrich Bolz <cfb...@gmx.de> 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
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to