One thing that I don't like is the way cgi forces you to treat every
param as if there were multiples, when most of the time you're dealing
with single params.

I know you can do things like

multiple, = cgi["multiple"]

or

multiple = cgi["multiple"][0]

but these seem crufty.  Here's an idea I had:


# query string =>  "multiple=something&key=value&multiple=somethingelse"
cgi["multiple"]                  # <= "something"
cgi["multiple"].multiple         # <= ["something", "somethingelse"]

cgi["key"]                       # <= "value"
cgi["key"].multiple              # <= ["value"]


This api would handle the most common case in a very intuitive way for
the programmer.  It also allows the programmer to explicitly handle
multiple params.

This is part of my work on a larger reorganization of CGI*.  However,
if it seems like a good idea I'd be willing to implement this behavior
in the current library.

What do you think? Would this be a nicer way of handling cgi params?
Has this issue been handled in other ways?

~ Patrick

* http://www.hexane.org/cgi-bin/hexane.cgi?page=TheNarfFramework --
very much in gestation, though there is code (not vaporware!)