[Tutor] FieldStorage solution summary
Daniel Yoo
dyoo@hkn.eecs.berkeley.edu
Wed, 2 May 2001 00:50:14 -0700 (PDT)
On Tue, 1 May 2001, Lance E Sloan wrote:
> With the suggestions I had gotten about converting FieldStorage to a
> dictionary, I came up with this function, dictcat, that will take any
> number of dictionaries or FieldStorage objects and concatenate them
> into a single dictionary. When you run this as-is, it will print out
> the results of the examples:
The code looks good. The only thing I could argue for is:
> if (type(d) == type({})):
which might be better off as types.DictType, but they, we've had a lot of
religious argument about this.
I'm not sure if dictcat() should have to worry about non-dictionaries; it
might be better off giving a message that dictcat() needs to take a
dictonary-like object; otherwise, it might obscure some errors that the
programmer might forget to check.