[Zope3-dev] Please, no bare 'except:' clauses!

Ken Manheimer klm@zope.com
Mon, 11 Nov 2002 19:19:36 -0500 (EST)


On Mon, 11 Nov 2002, Guido van Rossum wrote:

> > Maybe we should start documenting places where bare except is
> > acceptable and where it isn't.  Not as an exclusive list, but as a
> >   [...]
> > - In a framework,
> 
> What's a framework?  "Framework" is one of those words that mean
> whatever you wish it to mean. :-)
> 
> >   where the outermost driver needs to prevent the
> >   exception from percolating out of the framework, or the framework
> >   wants to log the exception and move on.  E.g.
> >   [...]
> This feels similar to the command line processor in e.g. IDLE.

I call these things "executors" or "executives" - some layer that is
responsible for executing code passed in from a higher layer.

> The common characteristic seems to be that these take external
> descriptions of some work to be done, and they should report success
> or failure, plus details like output or traceback.  RPC servers
> typically also do this: any exceptions raised by an incoming call
> should be caught and propagated to the client, rather than killing the
> RPC server.

Right - the executor essentially maintains a context or contexts for
the clients and executes code for the clients, and it reports back
results including details of exceptions.  Even the python command
prompt is one of these things...

-- 
Ken
klm@zope.com