cgi.py inefficiency (with fix)

Thomas Bellman bellman at lysator.liu.se
Mon Nov 29 12:20:38 EST 1999


T. Moddletin at news.vex.net (T. Moddletin) writes:

> On 17 Nov 1999 12:48:01 GMT, Thomas Bellman <bellman at lysator.liu.se> wrote:
>> searches to find things.  Is there any reason why this is done,
>> instead of having a dictionary of lists?

> After some thought i suddenly realised why this may be so. In fact
> it is possible that a CGI may recieve mulitiple values for the 
> same key. In this circumstance obviously a python dictionary will
> not function, as if you assign to a key it will overwrite the
> previous contents. However, i just offer this as a theoretical 
> reason, as i've not looked at the code or how it is handled.

That is why I suggested a dictionary of *lists*.

> Of course whether this would be worth the trouble in most cases
> I don't know. Perhaps i shouldn't spout off without having 
> read the code to actually know what it all does. Nor 
> have I read your diff to see what it actually does. (-:

No, you shouldn't, because my patch *does* handle that case.

-- 
Thomas Bellman,   Lysator Computer Club,   Linköping University,  Sweden
"I refuse to have a battle of wits with an   !  bellman @ lysator.liu.se
 unarmed person."                            !  Make Love -- Nicht Wahr!




More information about the Python-list mailing list