adding a simulation mode

Chris Angelico rosuav at gmail.com
Fri Jul 13 13:24:13 EDT 2012


On Sat, Jul 14, 2012 at 3:08 AM, Prasad, Ramit
<ramit.prasad at jpmorgan.com> wrote:
> I would say the opposite. In production code usually I want it
> to recover, log as much information as I need (including sending
> any notifications), and NOT just die.
>
> In development, not catching the exception will give me a full
> trace back automatically.

Here's another take on the matter. In development, your script is your
execution unit, so you let the interpreter print out your tracebacks.
In production, there will usually be one, maybe two subunits (for
instance, a TCP-based server might have the socket connection as an
execution unit, and possibly a command parser inside that), and at the
top of that subunit, you have a broad exception handler that resets
that one unit (goes back and accepts another client, or waits for
another command). Otherwise, wide-scope exception handling is usually
a bad thing.

ChrisA



More information about the Python-list mailing list