[Web-SIG] Form field dictionaries

Ian Bicking ianb at colorstudy.com
Fri Oct 24 12:36:59 EDT 2003


On Friday, October 24, 2003, at 11:28 AM, David Fraser wrote:
> That's fine, but I think it's important that these methods are 
> available as an addition to a standard dictionary interface.
> I think the key point is, if somebody wants a list of values, they 
> probably know that they want a list.
> It's very difficult to write code by accident that would handle a list 
> of values as well as a string.
> So if somebody knows they want a list in certain circumstances, they 
> could call getlist()
> But I think the default dictionary return value should be the same as 
> getfirst().
> That saves endless checks for lists for those who don't need them.

Every time I have encountered an unexpected list it has been because of 
a bug somewhere else in my code.  I might use a getone() method that 
threw some exception when a list was encountered, but I'd *never* want 
to use getfirst().  getfirst() is sloppy programming.  (getlist() is 
perfectly fine though)

--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org




More information about the Web-SIG mailing list