cascading python executions only if return code is 0

Chris Angelico rosuav at gmail.com
Mon Dec 23 06:09:00 CET 2013


On Mon, Dec 23, 2013 at 3:57 PM, Roy Smith <roy at panix.com> wrote:
> More specifically, the assertion exception will get caught way up in
> some django middleware which will log a stack trace and return a HTTP
> 50-something.  This will typically be followed by somebody like me
> noticing the stack dump and trying to figure out WTF happened.
>
> Assertions are great tools.  People should use them more often.

You do have to be careful though, because they can be compiled out. If
it really is a "can't happen", then sure, but encouraging people to
use them for potentially obscure cases may be dangerous - if you never
happen to hit on it during development and then run with assertions
disabled, you won't see that stack trace.

However, they're still a lot more executable than other forms of comment :)

ChrisA



More information about the Python-list mailing list