Having looked at the FieldStorage code, I'm guessing the idea was that you
parse fields as they come in and append them to a list. This preserves
the original order of fields, in case it is needed.
I'm not sure that maintaining a dictionary alongside the list is the right
thing to do. It might be, but there are some difficult questions to answer
-e.g. how costly is a sequential search, and is the code complexity (and
fieldstorage code is no picnic to read as it is) worth the speedup?
Also while it would speed up retrieval, it will slow down the "write"
operation - when a field is added to fieldstorage you now need to append
it to the list, AND check whether it exists in the dictionary, then add it
there as well.
How often do developers access form fields via __getitem__? I noticed the
publisher does not use it - it iterates the list, so nothing would be
gained there.
Also, something else to consider - is there a simple programatic solution
that could be documented, e.g. something like
my_fs = util.FieldStorage(req)
dict_fs = {}
dict_fs.update(my_fs)
[have no idea whether this will work :-)]
and voila - you've got a dictionary based fieldstorage?
Anyway, just a few cents from me.
Grisha