[Tutor] FieldStorage solution summary

Daniel Yoo dyoo@hkn.eecs.berkeley.edu
Thu, 3 May 2001 01:09:32 -0700 (PDT)


On Wed, 2 May 2001, Lance E Sloan wrote:

> Daniel Yoo wrote:
> > 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.
> 
> I admit the name of the function might be misleading, but its
> primary purpose in life is to convert FieldStorage to dictionary.
> Do you mean that I should split this into two functions, one for
> converting FieldStorage and the other for concatenating dictionaries?
> Or do you mean that I should have the function throw an exception
> if it is passed an argument that's not a dictionary or FieldStorage?


This is nothing big; I'm just trying to interpret what it means to:

    dictcat("hello world").

*grin* I think it's a great idea to merge dictionaries and FieldStorages,
since they both serve the same purpose of mapping names to things; I just
thought it was unusual that one of your test cases stuffs weird things
like numbers and strings into the argument list of your dictcat().