I have a suggestion for speeding up the performance of code like this:

fields = cgi.FieldStorage()
if fields: ...

which, as it turns out, invokes FieldStorage.__len__(), which in turn
calls FieldStorage.keys(), which builds a list of keys by hand, taking
several minutes for large forms.  This implementation of keys() reduces
the amount of time taken by several orders of magnitude:

    def keys(self):
        return {}.fromkeys([i.name for i in self.list]).keys()

Is there a better place for submitting suggestions like this?

Bob Kline
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to