Apologies for the TABs -- I wrote that example for demonstration purposes in my 
mail client -- I'll copy and paste from a real code editor in the future.
Ben

On May 7, 2010, at 3:28 PM, Aahz wrote:

> In article <mailman.2715.1273204222.23598.python-l...@python.org>,
> Ben Cohen  <nco...@ucsd.edu> wrote:
>> 
>> eg -- I'd like to do something like this:
>> 
>> errors = []
>> for item in data:
>>   try:
>>       process(item)
>>   except ValidationError as e:
>>       errors.append(e)
>> raise MultipleValidationErrors(*errors)
> 
> First of all, please DO NOT post code with TABs in it.  In fact, you
> shouldn't even be writing code with TABs -- TAB characters are obsolete
> for new Python code.
> 
> I would write your code this way:
> 
> errors = []
> for item in data:
>    try:
>        process(item)
>    except ValidationError as e:
>        errors.append(str(e))
> if errors:
>    raise MultipleValidationErrors(errors)
> -- 
> Aahz (a...@pythoncraft.com)           <*>         http://www.pythoncraft.com/
> 
> f u cn rd ths, u cn gt a gd jb n nx prgrmmng.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to