The Samurai Principle

Ian Kelly ian.g.kelly at gmail.com
Tue Sep 7 20:21:16 CEST 2010


On Tue, Sep 7, 2010 at 11:52 AM, Phlip <phlip2005 at gmail.com> wrote:
> And no it's not "much clearer".

It's clearer because it does exactly what it says it does, unlike your
approach that masquerades as a loop.

> Exceptions are for catastrophic errors

No, they're for flagging "exceptional" states.  /Errors/ are for
catastrophic errors.  The fact that errors are a subset of exceptions
is just for convenience in handling.

> AAAND you need to test that the DoesNotExist occurs for the exact
> reason you expect.

I'm not following you here.  The only possible reason the exception
can occur is if no matching row exists.  If there were some other
reason for raising an exception, then a different exception would be
raised.

> Your except is not complete. Making it complete is
> very hard, and will break as soon as the model changes.

Still not following you.  What is it missing, and how will it break?



More information about the Python-list mailing list