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

Reply via email to